File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -337,8 +337,11 @@ def rename_fname(self):
337337 done_list = set ()
338338 for fid in list (self .renamed_map .keys ()):
339339 fname = self .renamed_map [fid ]
340+ original_ext = os .path .splitext (fname )[1 ]
341+ if original_ext == "" :
342+ original_ext = os .path .splitext (fname )[0 ]
340343 # if we don't need to rename to original name and file type matches
341- if not self .config ['rename_ori' ] and os . path . splitext ( fname )[ 1 ] .lower () == '.jpg' :
344+ if not self .config ['rename_ori' ] and original_ext .lower () == '.jpg' :
342345 continue
343346 fname_ori = os .path .join (fpath , self .get_fidpad (fid )) # id
344347 if self .config ['rename_ori' ]:
@@ -353,7 +356,7 @@ def rename_fname(self):
353356 # will have zero knowledge about file type before scanning all per page,
354357 # thus can't determine if this id is downloaded, because file type is not
355358 # necessarily .jpg
356- fname_to = os .path .join (fpath , self .get_fidpad (fid , os . path . splitext ( fname )[ 1 ] [1 :]))
359+ fname_to = os .path .join (fpath , self .get_fidpad (fid , original_ext [1 :]))
357360 while fname_ori != fname_to :
358361 if os .path .exists (fname_ori ):
359362 while os .path .exists (fname_to ):
You can’t perform that action at this time.
0 commit comments