Clean up presigned URL implementation: remove dead fields, fix error handling

- Remove unused image_url from upload response and TS type
- Remove bare except in serve_image that masked config errors as 404s
- Add error state and broken-image placeholder in QuestionBubble

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-04 08:49:01 -04:00
parent b62a8b6b3f
commit 64dab18428
3 changed files with 17 additions and 13 deletions

View File

@@ -123,22 +123,13 @@ async def upload_image():
await s3_upload_image(processed_bytes, key, output_content_type)
return jsonify(
{
"image_key": key,
"image_url": f"/api/conversation/image/{key}",
}
)
return jsonify({"image_key": key})
@conversation_blueprint.get("/image/<path:image_key>")
@jwt_refresh_token_required
async def serve_image(image_key: str):
try:
url = await s3_presigned_url(image_key)
except Exception:
return jsonify({"error": "Image not found"}), 404
url = await s3_presigned_url(image_key)
return jsonify({"url": url})