Spaces:
Sleeping

thabsheeeeeer commited on
Commit
7d1aaf0
·
verified ·
1 Parent(s): fd1e7f0

Update app/api/documents.py

Browse files
Files changed (1) hide show
  1. app/api/documents.py +5 -1
app/api/documents.py CHANGED
@@ -54,9 +54,11 @@ def get_document_file(
54
 
55
  # Check if it's GCS path
56
  if document.file_path.startswith("uploads/"):
 
57
  content = storage_service.download_file(document.file_path)
58
  if not content:
59
- raise HTTPException(status_code=404, detail="File not found in cloud storage")
 
60
 
61
  return StreamingResponse(
62
  io.BytesIO(content),
@@ -123,3 +125,5 @@ def delete_document(
123
  )
124
 
125
  return response
 
 
 
54
 
55
  # Check if it's GCS path
56
  if document.file_path.startswith("uploads/"):
57
+ print(f"DEBUG: Attempting to download {document.file_path} from bucket {storage_service.client.storage.from_('documents') if storage_service.client else 'None'}")
58
  content = storage_service.download_file(document.file_path)
59
  if not content:
60
+ print(f"ERROR: File download failed for path: {document.file_path}")
61
+ raise HTTPException(status_code=404, detail=f"File not found in cloud storage: {document.file_path}")
62
 
63
  return StreamingResponse(
64
  io.BytesIO(content),
 
125
  )
126
 
127
  return response
128
+
129
+ ![image](https://cdn-uploads.huggingface.co/production/uploads/69fddecca069a32448f4036d/35DV6hvOUO6GWPHqNbPYp.png)