Compare commits

...

2 Commits

Author SHA1 Message Date
Peuqui
4f8440650b
Merge 65c24fe8b3 into 3fe9f5fecb 2026-07-04 14:10:53 +08:00
Peuqui
65c24fe8b3 fix: allow multi-segment paths in userdata API routes
Change aiohttp route parameters from {file} to {file:.*} to allow
paths containing slashes (e.g. workflows/my-workflow.json).

The {file} parameter only matches a single path segment, causing 404
errors when the frontend requests files in subdirectories via
/userdata/workflows/filename.json instead of URL-encoding the slash.

While the frontend uses encodeURIComponent as a workaround, this fix
ensures the routes work correctly with both encoded and unencoded
paths, improving compatibility with external API consumers.

Closes #10151
2026-02-14 13:56:34 +01:00

View File

@ -331,7 +331,7 @@ class UserManager():
return path
@routes.get("/userdata/{file}")
@routes.get("/userdata/{file:.*}")
async def getuserdata(request):
path = get_user_data_path(request, check_exists=True)
if not isinstance(path, str):
@ -352,7 +352,7 @@ class UserManager():
"Content-Disposition": "attachment",
})
@routes.post("/userdata/{file}")
@routes.post("/userdata/{file:.*}")
async def post_userdata(request):
"""
Upload or update a user data file.
@ -415,7 +415,7 @@ class UserManager():
return web.json_response(resp)
@routes.delete("/userdata/{file}")
@routes.delete("/userdata/{file:.*}")
async def delete_userdata(request):
path = get_user_data_path(request, check_exists=True)
if not isinstance(path, str):
@ -425,7 +425,7 @@ class UserManager():
return web.Response(status=204)
@routes.post("/userdata/{file}/move/{dest}")
@routes.post("/userdata/{file:.*}/move/{dest:.*}")
async def move_userdata(request):
"""
Move or rename a user data file.