remove null strings from file metadata
This commit is contained in:
parent
1e082c3d1b
commit
8ab68826b5
2 changed files with 6 additions and 0 deletions
|
@ -530,6 +530,7 @@ class File(db.Model):
|
|||
|
||||
filename = '%s.%s' % (title, extension)
|
||||
new_path = os.path.join(author[0].upper(), author, filename)
|
||||
new_path = new_path.replace('\x00', '')
|
||||
if self.path == new_path:
|
||||
return
|
||||
h = ''
|
||||
|
|
|
@ -54,6 +54,11 @@ def metadata(f, from_=None):
|
|||
data[key] = info[key]
|
||||
if key in opf_info:
|
||||
data[key] = opf_info[key]
|
||||
if key in data[key]:
|
||||
if isinstance(data[key], basestring):
|
||||
data[key] = data[key].replace('\x00', '')
|
||||
elif isinstance(data[key], list):
|
||||
data[key] = [e.replace('\x00', '') if isinstance(e, basestring) else e for e in data[key]]
|
||||
if 'isbn' in data:
|
||||
data['primaryid'] = ['isbn', data['isbn'][0]]
|
||||
elif 'asin' in data:
|
||||
|
|
Loading…
Reference in a new issue