Deny invalid files on Windows
This commit is contained in:
parent
f172751df3
commit
d569d9488a
2 changed files with 23 additions and 3 deletions
|
@ -599,6 +599,12 @@ class ContentManager(object):
|
|||
return False
|
||||
elif len(relative_path) > 255:
|
||||
return False
|
||||
elif relative_path[0] in (".", "/"): # Starts with
|
||||
return False
|
||||
elif relative_path[-1] in (".", " "): # Ends with
|
||||
return False
|
||||
elif re.match(r".*(^|/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9]|CONOUT\$|CONIN\$)(\.|/|$)", relative_path, re.IGNORECASE): # Protected on Windows
|
||||
return False
|
||||
else:
|
||||
return re.match(r"^[^\x00-\x1F\"*:<>?\\|]+$", relative_path)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue