fix: Exporting zip cannot open the file (#1939)
This commit is contained in:
parent
7f0547a8b8
commit
eb76450cdc
@ -47,6 +47,8 @@ def write_image(zip_path: str, image_list: List[str]):
|
|||||||
if text.startswith('(/api/file/'):
|
if text.startswith('(/api/file/'):
|
||||||
r = text.replace('(/api/file/', '').replace(')', '')
|
r = text.replace('(/api/file/', '').replace(')', '')
|
||||||
file = QuerySet(File).filter(id=r).first()
|
file = QuerySet(File).filter(id=r).first()
|
||||||
|
if file is None:
|
||||||
|
break
|
||||||
zip_inner_path = os.path.join('api', 'file', r)
|
zip_inner_path = os.path.join('api', 'file', r)
|
||||||
file_path = os.path.join(zip_path, zip_inner_path)
|
file_path = os.path.join(zip_path, zip_inner_path)
|
||||||
if not os.path.exists(os.path.dirname(file_path)):
|
if not os.path.exists(os.path.dirname(file_path)):
|
||||||
@ -56,6 +58,8 @@ def write_image(zip_path: str, image_list: List[str]):
|
|||||||
else:
|
else:
|
||||||
r = text.replace('(/api/image/', '').replace(')', '')
|
r = text.replace('(/api/image/', '').replace(')', '')
|
||||||
image_model = QuerySet(Image).filter(id=r).first()
|
image_model = QuerySet(Image).filter(id=r).first()
|
||||||
|
if image_model is None:
|
||||||
|
break
|
||||||
zip_inner_path = os.path.join('api', 'image', r)
|
zip_inner_path = os.path.join('api', 'image', r)
|
||||||
file_path = os.path.join(zip_path, zip_inner_path)
|
file_path = os.path.join(zip_path, zip_inner_path)
|
||||||
if not os.path.exists(os.path.dirname(file_path)):
|
if not os.path.exists(os.path.dirname(file_path)):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user