Skip to content

Commit

Permalink
fix(file import): encode file names in NFC format
Browse files Browse the repository at this point in the history
  • Loading branch information
massi-ang authored and bigadsoleiman committed Dec 20, 2023
1 parent f9277a7 commit a8c6709
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/shared/layers/python-sdk/python/genai_core/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import boto3
import genai_core.workspaces
import genai_core.types
import unicodedata

UPLOAD_BUCKET_NAME = os.environ.get("UPLOAD_BUCKET_NAME")
MAX_FILE_SIZE = 100 * 1000 * 1000 # 100Mb
Expand All @@ -10,6 +11,7 @@
def generate_presigned_post(workspace_id: str, file_name: str, expiration=3600):
s3_client = boto3.client("s3")

file_name = unicodedata.normalize("NFC", file_name)
workspace = genai_core.workspaces.get_workspace(workspace_id)
if not workspace:
raise genai_core.types.CommonError(f"Workspace not found")
Expand Down

0 comments on commit a8c6709

Please sign in to comment.