This commit is contained in:
j 2019-01-14 17:34:28 +05:30
commit c862faddd1
2 changed files with 6 additions and 2 deletions

View file

@ -788,7 +788,7 @@ class File(db.Model):
new_path = os.path.join(first, author, filename)
if current_path == os.path.join(prefix, new_path):
break
if self.path != new_path:
if unicodedata.normalize('NFD', self.path) != unicodedata.normalize('NFD', new_path):
path = os.path.join(prefix, new_path)
ox.makedirs(os.path.dirname(path))
mode = 0o644
@ -797,7 +797,7 @@ class File(db.Model):
shutil.move(current_path, path)
except:
logger.debug('failed to move %s to %s', current_path, path, exc_info=True)
if os.path.exists(path) and os.path.exists(current_path):
if os.path.exists(path):
os.unlink(path)
return
logger.debug('mv "%s" "%s"', self.path, new_path)