fix gadio issue with sending files between tabs
This commit is contained in:
parent
d3463bc59a
commit
20a1f68c75
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue