mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
HTML Input: Collapse multiple spaces in filenames when sanitizing them. Fixes #1788187 [When creating epub references with spaces in content.opf should be transformed in %20](https://bugs.launchpad.net/calibre/+bug/1788187)
This commit is contained in:
parent
7f255f141d
commit
085e813cbc
@ -20,7 +20,9 @@ from calibre.utils.imghdr import what
|
||||
|
||||
|
||||
def sanitize_file_name(x):
|
||||
return re.sub(r'[?&=;#]', '_', ascii_filename(x))
|
||||
ans = re.sub(r'\s+', ' ', re.sub(r'[?&=;#]', '_', ascii_filename(x))).strip().rstrip('.')
|
||||
ans, ext = ans.rpartition('.')[::2]
|
||||
return ans.strip() + '.' + ext.strip()
|
||||
|
||||
|
||||
class HTMLInput(InputFormatPlugin):
|
||||
|
Loading…
x
Reference in New Issue
Block a user