Skip to content

Commit 5c74aca

Browse files
authored
Merge pull request #6 from jlab/test_existance
test if fileobject exists prior to delete attempt
2 parents f305ed2 + 0763558 commit 5c74aca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

qiita_client/qiita_client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -919,10 +919,11 @@ def delete_file_from_central(self, filepath):
919919
The given filepath - to be transparent in plugin code.
920920
"""
921921
if self._plugincoupling == 'filesystem':
922-
if os.path.isdir(filepath):
923-
shutil.rmtree(filepath)
924-
else:
925-
os.remove(filepath)
922+
if os.path.exists(filepath):
923+
if os.path.isdir(filepath):
924+
shutil.rmtree(filepath)
925+
else:
926+
os.remove(filepath)
926927
elif self._plugincoupling == 'https':
927928
# will return in internal server error, when qiita is in productive
928929
# mode

0 commit comments

Comments
 (0)