Skip to content

Commit 76ed7de

Browse files
committed
handle powershell tilde expansion
1 parent 9e53e3d commit 76ed7de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

confluence_markdown_exporter/confluence.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ def from_json(cls, data: JsonResponse) -> "Space":
180180
@classmethod
181181
@functools.lru_cache(maxsize=100)
182182
def from_key(cls, space_key: str) -> "Space":
183+
# Personal Confluence spaces start with ~. Exporting them on Windows leads to
184+
# Powershell expanding tilde to the Users directory, which is handled here
185+
space_key = re.sub(r"^[A-Z]:\\Users\\", "~", space_key, count=1, flags=re.IGNORECASE)
186+
183187
return cls.from_json(
184188
cast("JsonResponse", confluence.get_space(space_key, expand="homepage"))
185189
)

0 commit comments

Comments
 (0)