Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -346,6 +346,8 @@ def upload_file(file: UploadFile = File(...), file_type: str = Form(...), curren
|
|
| 346 |
if len(content) > max_size:
|
| 347 |
raise HTTPException(status_code=400, detail=f"文件过大,{file_type} 类型请限制在 {max_size // (1024*1024)}MB 以内")
|
| 348 |
|
|
|
|
|
|
|
| 349 |
ext = file.filename.split(".")[-1].lower()
|
| 350 |
allowed_exts = ["jpg", "jpeg", "png", "gif", "webp", "json", "mp4"]
|
| 351 |
if file_type == "post_video":
|
|
|
|
| 346 |
if len(content) > max_size:
|
| 347 |
raise HTTPException(status_code=400, detail=f"文件过大,{file_type} 类型请限制在 {max_size // (1024*1024)}MB 以内")
|
| 348 |
|
| 349 |
+
if not file.filename:
|
| 350 |
+
raise HTTPException(status_code=400, detail="文件名不能为空")
|
| 351 |
ext = file.filename.split(".")[-1].lower()
|
| 352 |
allowed_exts = ["jpg", "jpeg", "png", "gif", "webp", "json", "mp4"]
|
| 353 |
if file_type == "post_video":
|