From 9e0051ca9ce6d074bb6bf4690f5af7f18830b897 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Wed, 19 Feb 2020 16:23:31 -0800 Subject: [PATCH] Photo.move_file assert new path doesn't exist yet. --- etiquette/objects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index e12f4e6..c22b89b 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -924,8 +924,9 @@ class Photo(ObjectBase): def move_file(self, directory, commit=True): directory = pathclass.Path(directory) directory.assert_is_directory() - new_path = directory.with_child(self.real_path.basename).absolute_path - self.rename_file(new_path, move=True, commit=commit) + new_path = directory.with_child(self.real_path.basename) + new_path.assert_not_exists() + self.rename_file(new_path.absolute_path, move=True, commit=commit) #@decorators.time_me @decorators.required_feature('photo.reload_metadata')