Browse Source

Update server.py 自己测试了,没有报错了

# Normalize paths to ensure the same drive letter
                    full_output_dir = os.path.normpath(full_output_dir)
                    output_dir = os.path.normpath(output_dir)                    
                    
                    # Extract drive letters from paths
                    drive_full_output_dir = os.path.splitdrive(os.path.abspath(full_output_dir))[0]
                    drive_output_dir = os.path.splitdrive(os.path.abspath(output_dir))[0]

                    if drive_full_output_dir != drive_output_dir:
                        return web.Response(status=403)
                    output_dir = full_output_dir
pull/2590/head
vxkj1211 10 months ago committed by GitHub
parent
commit
be1d1cad2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      server.py

8
server.py

@ -270,11 +270,15 @@ class PromptServer():
if "subfolder" in request.rel_url.query:
full_output_dir = os.path.join(output_dir, request.rel_url.query["subfolder"])
# Normalize paths to ensure the same drive letter
# Normalize paths to ensure the same drive letter
full_output_dir = os.path.normpath(full_output_dir)
output_dir = os.path.normpath(output_dir)
if os.path.commonpath((os.path.abspath(full_output_dir), output_dir)) != output_dir:
# Extract drive letters from paths
drive_full_output_dir = os.path.splitdrive(os.path.abspath(full_output_dir))[0]
drive_output_dir = os.path.splitdrive(os.path.abspath(output_dir))[0]
if drive_full_output_dir != drive_output_dir:
return web.Response(status=403)
output_dir = full_output_dir

Loading…
Cancel
Save