aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-15 15:44:46 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-10-15 15:44:46 +0300
commit20a1f68c752f8e37492ea00911c97bfc572a6e67 (patch)
treeb963a3d32ce9c65869c1a5ef725e90686e14268b
parentd3463bc59a44d62c2de8b357184c49876d84f654 (diff)
fix gadio issue with sending files between tabs
-rw-r--r--modules/ui.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/ui.py b/modules/ui.py
index cab8ab11..c9b53247 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -91,6 +91,14 @@ def plaintext_to_html(text):
def image_from_url_text(filedata):
+ if type(filedata) == dict and filedata["is_file"]:
+ filename = filedata["name"]
+ tempdir = os.path.normpath(tempfile.gettempdir())
+ normfn = os.path.normpath(filename)
+ assert normfn.startswith(tempdir), 'trying to open image file not in temporary directory'
+
+ return Image.open(filename)
+
if type(filedata) == list:
if len(filedata) == 0:
return None