From 1f947c017d796d3a03336999cc379790730039a9 Mon Sep 17 00:00:00 2001 From: Massimiliano Angelino Date: Wed, 20 Dec 2023 14:33:21 +0100 Subject: [PATCH] fix(file import): encode file names in NFC format --- lib/shared/layers/python-sdk/python/genai_core/upload.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/shared/layers/python-sdk/python/genai_core/upload.py b/lib/shared/layers/python-sdk/python/genai_core/upload.py index 636b86b33..4da396328 100644 --- a/lib/shared/layers/python-sdk/python/genai_core/upload.py +++ b/lib/shared/layers/python-sdk/python/genai_core/upload.py @@ -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 @@ -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")