Skip to content

Commit

Permalink
feat(app):
Browse files Browse the repository at this point in the history
- support empty name image
  • Loading branch information
MorvanZhou committed Aug 5, 2024
1 parent 89bdad9 commit e1bb5fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/retk/core/files/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async def fetch_image_vditor(au: AuthedUser, url: str, count=0) -> Tuple[str, co
content = response.content

file = UploadFile(
filename=url.split("?", 1)[0].split("/")[-1], # remove url parameters
filename=url.split("?", 1)[0].split("/")[-1].strip(), # remove url parameters
file=io.BytesIO(content),
headers=Headers(response.headers),
size=len(content)
Expand All @@ -183,6 +183,8 @@ async def fetch_image_vditor(au: AuthedUser, url: str, count=0) -> Tuple[str, co
if not file.content_type.startswith(const.app.ValidUploadedFilePrefixEnum.IMAGE.value):
return "", const.CodeEnum.INVALID_FILE_TYPE

if file.filename == "":
file.filename = f"image.{file.content_type.split('/')[1]}"
res = await sync_tasks.save_editor_upload_files(
uid=au.u.id,
files=[file],
Expand Down

0 comments on commit e1bb5fb

Please sign in to comment.