move can fail
This commit is contained in:
parent
8872141032
commit
dcdf864dd7
1 changed files with 5 additions and 1 deletions
|
@ -787,7 +787,11 @@ class File(db.Model):
|
||||||
if self.path != new_path:
|
if self.path != new_path:
|
||||||
path = os.path.join(prefix, new_path)
|
path = os.path.join(prefix, new_path)
|
||||||
ox.makedirs(os.path.dirname(path))
|
ox.makedirs(os.path.dirname(path))
|
||||||
|
try:
|
||||||
shutil.move(current_path, path)
|
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.path = new_path
|
||||||
self.save()
|
self.save()
|
||||||
for folder in set(os.path.dirname(p) for p in [current_path, path]):
|
for folder in set(os.path.dirname(p) for p in [current_path, path]):
|
||||||
|
|
Loading…
Reference in a new issue