Spaces:
Sleeping
Sleeping
unknown commited on
Commit ·
047c991
1
Parent(s): b52459a
fix: s3
Browse files
server.py
CHANGED
|
@@ -299,13 +299,13 @@ def create_app() -> Flask:
|
|
| 299 |
file_stream,
|
| 300 |
S3_BUCKET_NAME,
|
| 301 |
file_key,
|
| 302 |
-
ExtraArgs={'ContentType': 'image/jpeg'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
)
|
| 304 |
-
|
| 305 |
-
# Construct URL
|
| 306 |
-
# Note: This assumes standard AWS S3 URL format. Adjust if using CloudFront.
|
| 307 |
-
s3_url = f"https://{S3_BUCKET_NAME}.s3.amazonaws.com/{file_key}"
|
| 308 |
-
|
| 309 |
return jsonify({
|
| 310 |
"status": "success",
|
| 311 |
"url": s3_url
|
|
|
|
| 299 |
file_stream,
|
| 300 |
S3_BUCKET_NAME,
|
| 301 |
file_key,
|
| 302 |
+
ExtraArgs={'ContentType': 'image/jpeg'}
|
| 303 |
+
)
|
| 304 |
+
s3_url = s3_client.generate_presigned_url(
|
| 305 |
+
'get_object',
|
| 306 |
+
Params={'Bucket': S3_BUCKET_NAME, 'Key': file_key},
|
| 307 |
+
ExpiresIn=3600
|
| 308 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
return jsonify({
|
| 310 |
"status": "success",
|
| 311 |
"url": s3_url
|