Fix #8797 (calibre tries to create a faulty path from the meta data (exception))

This commit is contained in:
Kovid Goyal 2011-02-06 09:41:20 -07:00
parent ef51c4d198
commit b82399e305

View File

@ -432,6 +432,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
authors = _('Unknown')
author = ascii_filename(authors.split(',')[0])[:self.PATH_LIMIT].decode(filesystem_encoding, 'replace')
title = ascii_filename(self.title(id, index_is_id=True))[:self.PATH_LIMIT].decode(filesystem_encoding, 'replace')
while author[-1] in (' ', '.'):
author = author[:-1]
if not author:
author = ascii_filename(_('Unknown')).decode(filesystem_encoding, 'replace')
path = author + '/' + title + ' (%d)'%id
return path