Skip to content

Commit

Permalink
Merge pull request #1 from zzjc1234/fix/security_win
Browse files Browse the repository at this point in the history
fix: fail to upload figure
  • Loading branch information
zzjc1234 authored Jan 17, 2024
2 parents b0d2a9a + 4927cbe commit e3e5ba5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion canvas_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@
# INFO: Safety check for file
def check_file(filename):
base_path = "/public/res/"
base_path_win = "\\public\\res\\"
fullPath = path.normpath(path.join(base_path, filename))
if (
not "." in filename
or not filename.rsplit(".", 1)[1].lower() in ALLOWED_EXTENSION
):
return "Illegal"
if not fullPath.startswith(base_path):
if not fullPath.startswith(base_path) and not fullPath.startswith(base_path_win):
return "Illegal"
else:
return filename
Expand Down

0 comments on commit e3e5ba5

Please sign in to comment.