mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-29 21:13:33 +08:00
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
This commit is contained in:
parent
dc9822b7df
commit
65c24fe8b3
@ -330,7 +330,7 @@ class UserManager():
|
|||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@routes.get("/userdata/{file}")
|
@routes.get("/userdata/{file:.*}")
|
||||||
async def getuserdata(request):
|
async def getuserdata(request):
|
||||||
path = get_user_data_path(request, check_exists=True)
|
path = get_user_data_path(request, check_exists=True)
|
||||||
if not isinstance(path, str):
|
if not isinstance(path, str):
|
||||||
@ -338,7 +338,7 @@ class UserManager():
|
|||||||
|
|
||||||
return web.FileResponse(path)
|
return web.FileResponse(path)
|
||||||
|
|
||||||
@routes.post("/userdata/{file}")
|
@routes.post("/userdata/{file:.*}")
|
||||||
async def post_userdata(request):
|
async def post_userdata(request):
|
||||||
"""
|
"""
|
||||||
Upload or update a user data file.
|
Upload or update a user data file.
|
||||||
@ -394,7 +394,7 @@ class UserManager():
|
|||||||
|
|
||||||
return web.json_response(resp)
|
return web.json_response(resp)
|
||||||
|
|
||||||
@routes.delete("/userdata/{file}")
|
@routes.delete("/userdata/{file:.*}")
|
||||||
async def delete_userdata(request):
|
async def delete_userdata(request):
|
||||||
path = get_user_data_path(request, check_exists=True)
|
path = get_user_data_path(request, check_exists=True)
|
||||||
if not isinstance(path, str):
|
if not isinstance(path, str):
|
||||||
@ -404,7 +404,7 @@ class UserManager():
|
|||||||
|
|
||||||
return web.Response(status=204)
|
return web.Response(status=204)
|
||||||
|
|
||||||
@routes.post("/userdata/{file}/move/{dest}")
|
@routes.post("/userdata/{file:.*}/move/{dest:.*}")
|
||||||
async def move_userdata(request):
|
async def move_userdata(request):
|
||||||
"""
|
"""
|
||||||
Move or rename a user data file.
|
Move or rename a user data file.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user