Skip to content

Commit c478c93

Browse files
fix: Fix not processing all images when saving them
1 parent f75a527 commit c478c93

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

apps/knowledge/serializers/common.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ def write_image(zip_path: str, image_list: List[str]):
186186
if search:
187187
text = search.group()
188188
if text.startswith('(./oss/file/'):
189-
r = text.replace('(./oss/file/', '').replace(')', '')
190-
r = r.strip().split(" ")[0]
191-
if not is_valid_uuid(r):
192-
break
193-
file = QuerySet(File).filter(id=r).first()
189+
image_id = text.replace('(./oss/file/', '').replace(')', '')
190+
image_id = image_id.strip().split(" ")[0]
191+
if not is_valid_uuid(image_id):
192+
continue
193+
file = QuerySet(File).filter(id=image_id).first()
194194
if file is None:
195-
break
196-
zip_inner_path = os.path.join('oss', 'file', r)
195+
continue
196+
zip_inner_path = os.path.join('oss', 'file', image_id)
197197
file_path = os.path.join(zip_path, zip_inner_path)
198198
if not os.path.exists(os.path.dirname(file_path)):
199199
os.makedirs(os.path.dirname(file_path))

0 commit comments

Comments
 (0)