mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
WIP: Optimize /file route (#7416)
* Improve File route * file route fix * add changeset * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
a6371bbcae
commit
c88290d90a
5
.changeset/evil-lamps-refuse.md
Normal file
5
.changeset/evil-lamps-refuse.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
feat:WIP: Optimize /file route
|
@ -439,7 +439,11 @@ class App(FastAPI):
|
||||
if in_blocklist or is_dir:
|
||||
raise HTTPException(403, f"File not allowed: {path_or_url}.")
|
||||
|
||||
created_by_app = str(abs_path) in set().union(*blocks.temp_file_sets)
|
||||
created_by_app = False
|
||||
for temp_file_set in blocks.temp_file_sets:
|
||||
if abs_path in temp_file_set:
|
||||
created_by_app = True
|
||||
break
|
||||
in_allowlist = any(
|
||||
utils.is_in_or_equal(abs_path, allowed_path)
|
||||
for allowed_path in blocks.allowed_paths
|
||||
|
Loading…
Reference in New Issue
Block a user