normalize filenames as we sync

user still needs to run "check media" if their fields are encoded
incorrectly, but by fixing on the fly we'll ensure mediaSanity doesn't
fail
This commit is contained in:
Damien Elmes 2014-07-15 11:49:03 +09:00
parent ba8ed39e13
commit 3224a155a7

View file

@ -384,6 +384,15 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
if not os.path.getsize(f): if not os.path.getsize(f):
os.unlink(f) os.unlink(f)
continue continue
# check encoding
if not isMac:
normf = unicodedata.normalize("NFC", f)
if f != normf:
# wrong filename encoding which will cause sync errors
if os.path.exists(normf):
os.unlink(f)
else:
os.rename(f, normf)
# newly added? # newly added?
if f not in self.cache: if f not in self.cache:
added.append(f) added.append(f)