Always return a byte buffer. Sending the picture as URL text fails in some browsers.

This commit is contained in:
Marc-Andre Ferland
2022-11-01 04:52:42 -04:00
parent a39f845835
commit aa21115e26
3 changed files with 7 additions and 4 deletions

View File

@ -336,8 +336,6 @@ def get_image(session_id, img_id):
if not task.temp_images[img_id]: raise HTTPException(status_code=425, detail='Too Early, task data is not available yet.') # HTTP425 Too Early
try:
img_data = task.temp_images[img_id]
if isinstance(img_data, str):
return img_data
img_data.seek(0)
return StreamingResponse(img_data, media_type='image/jpeg')
except KeyError as e: