url encode filename
All checks were successful
Build and Publish / build-release (push) Successful in 48s
All checks were successful
Build and Publish / build-release (push) Successful in 48s
This commit is contained in:
@@ -58,9 +58,6 @@ def document_s3_key(org_id: str, document_id: str, filename: str) -> str:
|
||||
return f"{s3_path_prefix(org_id, document_id)}{filename}"
|
||||
|
||||
def sanitize_filename(filename: str) -> str:
|
||||
"""Sanitize filename for S3"""
|
||||
# Remove path separators and special characters
|
||||
filename = filename.replace("/", "_").replace("\\", "_")
|
||||
# Keep only safe characters
|
||||
safe_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_")
|
||||
return "".join(c for c in filename if c in safe_chars)
|
||||
"""URL encode filename for S3"""
|
||||
from urllib.parse import quote
|
||||
return quote(filename, safe="")
|
||||
|
||||
Reference in New Issue
Block a user