fix: path error

This commit is contained in:
tao.chen
2026-08-13 11:48:24 +08:00
parent 83d0e0adca
commit 3094a47298
+18 -4
View File
@@ -424,9 +424,16 @@ async def create_script_record(
workspace_id = context.workspace.workspace_id
content_hash = hashlib.sha256(content).hexdigest()
size_bytes = len(content)
if parent_ulid:
# Jupyter Contents API PUT does not create intermediate directories.
# Make sure the user's own subfolder exists at the Jupyter level before
# we try to write into it; on nested creates, also ensure the parent
# directory under it. ensure_directory is idempotent (GET-first pattern).
try:
await runtime_client.ensure_directory(workspace_id, f"{user_id}/{parent_ulid}")
await runtime_client.ensure_directory(workspace_id, user_id)
if parent_ulid:
await runtime_client.ensure_directory(
workspace_id, f"{user_id}/{parent_ulid}"
)
except RuntimeClientError as exc:
raise HTTPException(
status_code=exc.status_code,
@@ -826,9 +833,16 @@ async def create_workspace_directory(
runtime_client = request.app.state.runtime_client
workspace_id = context.workspace.workspace_id
if parent_ulid:
# Jupyter Contents API PUT does not create intermediate directories.
# Make sure the user's own subfolder exists at the Jupyter level before
# we try to write into it; on nested creates, also ensure the parent
# directory under it. ensure_directory is idempotent (GET-first pattern).
try:
await runtime_client.ensure_directory(workspace_id, f"{user_id}/{parent_ulid}")
await runtime_client.ensure_directory(workspace_id, user_id)
if parent_ulid:
await runtime_client.ensure_directory(
workspace_id, f"{user_id}/{parent_ulid}"
)
except RuntimeClientError as exc:
raise HTTPException(
status_code=exc.status_code,