From 967867d48c29666630edfa10a1ab711217e3094e Mon Sep 17 00:00:00 2001 From: Darion Date: Sun, 8 Sep 2024 21:02:32 -0400 Subject: [PATCH] fix: url decode filename from API (#4801) --- app/user_manager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/user_manager.py b/app/user_manager.py index 53dff18b..95ad157c 100644 --- a/app/user_manager.py +++ b/app/user_manager.py @@ -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: