fix(file): Remove illegal chars in file_name
- / and \ cannot work as file names - % is not allowed verbatim in URLs - ? and # are not allowed because confused with query/hash separators
This commit is contained in:
parent
6b7c0007fe
commit
772df163cf
1 changed files with 1 additions and 1 deletions
|
|
@ -675,7 +675,7 @@ class File(Document):
|
|||
return self.save_file_on_filesystem()
|
||||
|
||||
def save_file_on_filesystem(self):
|
||||
safe_file_name = self.file_name.replace("%", "_")
|
||||
safe_file_name = re.sub(r"[/\\%?#]", "_", self.file_name)
|
||||
if self.is_private:
|
||||
self.file_url = f"/private/files/{safe_file_name}"
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue