mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
When generating template based filenames replace multiple spaces with a single space
This commit is contained in:
parent
314f8fefd4
commit
43b51ed334
@ -99,7 +99,8 @@ def preprocess_template(template):
|
||||
|
||||
def safe_format(x, format_args):
|
||||
try:
|
||||
return x.format(**format_args).strip()
|
||||
ans = x.format(**format_args).strip()
|
||||
return re.sub(r'\s+', ' ', ans)
|
||||
except IndexError: # Thrown if user used [] and index is out of bounds
|
||||
pass
|
||||
except AttributeError: # Thrown if user used a non existing attribute
|
||||
|
Loading…
x
Reference in New Issue
Block a user