Trim whitespace from filename

This avoids an OSError when the book's metadata has whitespace at the end of it.
pull/1562/head
Ryan Holmes 4 years ago committed by GitHub
parent 1a1d105fae
commit 969105b205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -254,7 +254,7 @@ def get_valid_filename(value, replace_whitespace=True):
value = re.sub(r'[\*\+:\\\"/<>\?]+', u'_', value, flags=re.U)
# pipe has to be replaced with comma
value = re.sub(r'[\|]+', u',', value, flags=re.U)
value = value[:128]
value = value[:128].strip()
if not value:
raise ValueError("Filename cannot be empty")
if sys.version_info.major == 3:

Loading…
Cancel
Save