Compare commits

...

2 Commits

Author SHA1 Message Date
Peuqui
6b8c2befd7
Merge 65c24fe8b3 into fce0398470 2026-04-29 18:57:34 +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):
@ -339,7 +339,7 @@ class UserManager():
return web.FileResponse(path)
@routes.post("/userdata/{file}")
@routes.post("/userdata/{file:.*}")
async def post_userdata(request):
"""
Upload or update a user data file.
@ -402,7 +402,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):
@ -412,7 +412,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.