fix: url decode filename from API

This commit is contained in:
w1gs 2024-09-05 21:52:13 -04:00
parent 0c7c98a965
commit e88583936d

View File

@ -5,6 +5,7 @@ import uuid
import glob
import shutil
from aiohttp import web
from urllib import parse
from comfy.cli_args import args
from folder_paths import user_directory
from .app_settings import AppSettings
@ -59,6 +60,10 @@ class UserManager():
return None
if file is not None:
# Check if filename is url encoded
if "%" in file:
file = parse.unquote(file)
# prevent leaving /{type}/{user}
path = os.path.abspath(os.path.join(user_root, file))
if os.path.commonpath((user_root, path)) != user_root: