Skip to content

ValueError exception when requesting an image on a different drive #1488

Open
@ali1234

Description

@ali1234

ComfyUI/server.py

Lines 270 to 271 in 9562a6b

if os.path.commonpath((os.path.abspath(full_output_dir), output_dir)) != output_dir:
return web.Response(status=403)

This code attempts to determine whether the requested file is in the output directory. If not then it returns a 403 error. However, if the requested file is on a different drive to the output dir, then os.commonpath will raise a ValueError, because files on different drives cannot have any common components.

os.commonpath is used in a similar way in various other places.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is confirmed to not be working properly.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions