Commit ·
b7fbaeb
1
Parent(s): bb29492
[NOTICKET][doc] add guard if filename None
Browse files
src/pipeline/document_pipeline/document_pipeline.py
CHANGED
|
@@ -22,6 +22,8 @@ class DocumentPipeline:
|
|
| 22 |
async def upload(self, file: UploadFile, user_id: str, db: AsyncSession) -> dict:
|
| 23 |
"""Validate → upload to blob → save to DB."""
|
| 24 |
content = await file.read()
|
|
|
|
|
|
|
| 25 |
file_type = file.filename.split(".")[-1].lower() if "." in file.filename else "txt"
|
| 26 |
|
| 27 |
if len(content) > MAX_FILE_SIZE_BYTES:
|
|
|
|
| 22 |
async def upload(self, file: UploadFile, user_id: str, db: AsyncSession) -> dict:
|
| 23 |
"""Validate → upload to blob → save to DB."""
|
| 24 |
content = await file.read()
|
| 25 |
+
if not file.filename:
|
| 26 |
+
raise HTTPException(status_code=400, detail="Filename is required.")
|
| 27 |
file_type = file.filename.split(".")[-1].lower() if "." in file.filename else "txt"
|
| 28 |
|
| 29 |
if len(content) > MAX_FILE_SIZE_BYTES:
|