mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-04 12:56:24 +01:00
Ensure there is never a double space after the title when creating file/folder names in the calibre library
This commit is contained in:
parent
9713536660
commit
e7a2bd2691
1 changed files with 6 additions and 2 deletions
|
|
@ -1111,7 +1111,9 @@ def construct_path_name(self, book_id, title, author):
|
|||
book_id = ' (%d)' % book_id
|
||||
l = self.PATH_LIMIT - (len(book_id) // 2) - 2
|
||||
author = ascii_filename(author)[:l].decode('ascii', 'replace')
|
||||
title = ascii_filename(title)[:l].decode('ascii', 'replace')
|
||||
title = ascii_filename(title.lstrip())[:l].decode('ascii', 'replace').rstrip()
|
||||
if not title:
|
||||
title = 'Unknown'[:l]
|
||||
try:
|
||||
while author[-1] in (' ', '.'):
|
||||
author = author[:-1]
|
||||
|
|
@ -1135,7 +1137,9 @@ def construct_file_name(self, book_id, title, author, extlen):
|
|||
if l < 5:
|
||||
raise ValueError('Extension length too long: %d' % extlen)
|
||||
author = ascii_filename(author)[:l].decode('ascii', 'replace')
|
||||
title = ascii_filename(title)[:l].decode('ascii', 'replace')
|
||||
title = ascii_filename(title.lstrip())[:l].decode('ascii', 'replace').rstrip()
|
||||
if not title:
|
||||
title = 'Unknown'[:l]
|
||||
name = title + ' - ' + author
|
||||
while name.endswith('.'):
|
||||
name = name[:-1]
|
||||
|
|
|
|||
Loading…
Reference in a new issue