Skip to content

Commit 1f8093c

Browse files
committed
Fix export handler path parsing
1 parent 3627907 commit 1f8093c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

jupytercad_freecad/handlers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ class JCadExportHandler(APIHandler):
3232
def post(self):
3333
body = self.get_json_body()
3434

35-
file_name = body["path"].split(":")[1]
35+
# Works with both prefixed and unprefixed paths
36+
path = body.get("path", "")
37+
parts = path.split(":", 1)
38+
39+
if len(parts) == 2:
40+
file_name = parts[1]
41+
else:
42+
file_name = parts[0] # fallback: treat whole thing as path
43+
3644
export_name = body["newName"]
3745

3846
root_dir = Path(self.contents_manager.root_dir).resolve()

0 commit comments

Comments
 (0)