From dcdf864dd74743afc1067bf30c2af560f5b70124 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 26 Mar 2016 17:55:22 +0100 Subject: [PATCH] move can fail --- oml/item/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oml/item/models.py b/oml/item/models.py index a3605b6..13bb27e 100644 --- a/oml/item/models.py +++ b/oml/item/models.py @@ -787,7 +787,11 @@ class File(db.Model): if self.path != new_path: path = os.path.join(prefix, new_path) ox.makedirs(os.path.dirname(path)) - shutil.move(current_path, path) + try: + shutil.move(current_path, path) + except: + logger.debug('failed to move %s to %s', current_path, path, exc_info=True) + return self.path = new_path self.save() for folder in set(os.path.dirname(p) for p in [current_path, path]):