use sanitzed name
All checks were successful
Build and Publish / build-release (push) Successful in 45s
All checks were successful
Build and Publish / build-release (push) Successful in 45s
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user