archive: Check existance of the directory before rmdir
If the code path using os.renames is used, the directory would be removed. So check the existance of it before calling rmdir.
This commit is contained in:
@@ -319,6 +319,7 @@ class ArchiveTar(ArchiveBase):
|
|||||||
|
|
||||||
os.renames(old_path, new_path)
|
os.renames(old_path, new_path)
|
||||||
|
|
||||||
|
if os.path.exists(tarinfo.name):
|
||||||
os.rmdir(tarinfo.name)
|
os.rmdir(tarinfo.name)
|
||||||
|
|
||||||
elif not os.path.lexists(tarinfo.linkname):
|
elif not os.path.lexists(tarinfo.linkname):
|
||||||
|
|||||||
Reference in New Issue
Block a user