more NFD
This commit is contained in:
parent
07cdab8c2d
commit
c862faddd1
2 changed files with 6 additions and 2 deletions
|
@ -788,7 +788,7 @@ class File(db.Model):
|
||||||
new_path = os.path.join(first, author, filename)
|
new_path = os.path.join(first, author, filename)
|
||||||
if current_path == os.path.join(prefix, new_path):
|
if current_path == os.path.join(prefix, new_path):
|
||||||
break
|
break
|
||||||
if self.path != new_path:
|
if unicodedata.normalize('NFD', self.path) != unicodedata.normalize('NFD', 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))
|
||||||
mode = 0o644
|
mode = 0o644
|
||||||
|
@ -797,7 +797,7 @@ class File(db.Model):
|
||||||
shutil.move(current_path, path)
|
shutil.move(current_path, path)
|
||||||
except:
|
except:
|
||||||
logger.debug('failed to move %s to %s', current_path, path, exc_info=True)
|
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)
|
os.unlink(path)
|
||||||
return
|
return
|
||||||
logger.debug('mv "%s" "%s"', self.path, new_path)
|
logger.debug('mv "%s" "%s"', self.path, new_path)
|
||||||
|
|
|
@ -150,6 +150,8 @@ def run_scan():
|
||||||
if file:
|
if file:
|
||||||
f1 = file.fullpath()
|
f1 = file.fullpath()
|
||||||
f2 = os.path.join(prefix, f)
|
f2 = os.path.join(prefix, f)
|
||||||
|
f1 = unicodedata.normalize('NFD', f1)
|
||||||
|
f2 = unicodedata.normalize('NFD', f2)
|
||||||
if f1 != f2 and os.path.exists(f1) and os.path.exists(f2):
|
if f1 != f2 and os.path.exists(f1) and os.path.exists(f2):
|
||||||
logger.debug('file exists in multiple locations %s', id)
|
logger.debug('file exists in multiple locations %s', id)
|
||||||
logger.debug('"%s" vs "%s"', f1, f2)
|
logger.debug('"%s" vs "%s"', f1, f2)
|
||||||
|
@ -161,6 +163,8 @@ def run_scan():
|
||||||
if file:
|
if file:
|
||||||
f1 = file.fullpath()
|
f1 = file.fullpath()
|
||||||
f2 = os.path.join(prefix, f)
|
f2 = os.path.join(prefix, f)
|
||||||
|
f1 = unicodedata.normalize('NFD', f1)
|
||||||
|
f2 = unicodedata.normalize('NFD', f2)
|
||||||
if f1 != f2 and os.path.exists(f1) and os.path.exists(f2):
|
if f1 != f2 and os.path.exists(f1) and os.path.exists(f2):
|
||||||
logger.debug('"%s" vs "%s"', f1, f2)
|
logger.debug('"%s" vs "%s"', f1, f2)
|
||||||
os.chmod(f2, stat.S_IWRITE)
|
os.chmod(f2, stat.S_IWRITE)
|
||||||
|
|
Loading…
Reference in a new issue