From ee4b1faea495eba36ba61af1490683bd5763be3a Mon Sep 17 00:00:00 2001 From: HaimKortovich Date: Fri, 24 Apr 2026 12:18:06 -0500 Subject: [PATCH] use sanitzed name --- app/routers/documents.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/routers/documents.py b/app/routers/documents.py index 166453f..af916c7 100644 --- a/app/routers/documents.py +++ b/app/routers/documents.py @@ -45,14 +45,14 @@ async def upload_document( sanitized_filename = utils.sanitize_filename(file.filename) s3_key = utils.document_s3_key(org_id, document_id, sanitized_filename) - # Prepare metadata - metadata_dict = { - "org_id": org_id, - "document_type": document_type.value, - "filename": file.filename, - "file_size": str(file_size), - "created_at": datetime.utcnow().isoformat() - } + # Prepare metadata + metadata_dict = { + "org_id": org_id, + "document_type": document_type.value, + "filename": sanitized_filename, + "file_size": str(file_size), + "created_at": datetime.utcnow().isoformat() + } # Upload to S3 try: @@ -65,18 +65,18 @@ async def upload_document( # Generate download URL download_url = s3.presigned_download_url(s3_key) - # Create metadata response - metadata = DocumentMetadata( - document_id=document_id, - org_id=org_id, - document_type=document_type, - filename=file.filename, - content_type=detected_content_type, - file_size=file_size, - s3_key=s3_key, - created_at=datetime.utcnow(), - updated_at=datetime.utcnow() - ) + # Create metadata response + metadata = DocumentMetadata( + document_id=document_id, + org_id=org_id, + document_type=document_type, + filename=sanitized_filename, + content_type=detected_content_type, + file_size=file_size, + s3_key=s3_key, + created_at=datetime.utcnow(), + updated_at=datetime.utcnow() + ) logger.info(f"Upload completed - document_id: {document_id}") return UploadResponse(document_id=document_id, metadata=metadata, download_url=download_url)