some filesystems are case insensitive, always use case insensitive lookup

This commit is contained in:
j 2017-06-12 16:49:08 +02:00
commit 643e2e587e
2 changed files with 13 additions and 2 deletions

View file

@ -732,7 +732,7 @@ class File(db.Model):
def move(self):
def format_underscores(string):
return re.sub(r'^\.|\.$|:|/|\?|<|>|\\|\*', '_', string)
return re.sub(r'^\.|\.$|:|/|\?|<|>|\\|\*|\||"', '_', string)
prefs = settings.preferences
prefix = os.sep.join(os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/').split('/'))
if not self.item:
@ -779,7 +779,7 @@ class File(db.Model):
if self.path == new_path:
return
h = ''
while os.path.exists(os.path.join(prefix, new_path)):
while utils.iexists(os.path.join(prefix, new_path)):
h = self.sha1[:len(h)+1]
filename = '%s.%s.%s' % (title, h, extension)
first = unicodedata.normalize('NFD', author[0].upper())[0].upper()