mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression in filename shortening that caused loss of filename extension
This commit is contained in:
parent
fc8bcdc6f0
commit
3766f34aab
@ -54,10 +54,8 @@ def shorten_components_to(length, components):
|
|||||||
r = x[0] if x is components[-1] else ''
|
r = x[0] if x is components[-1] else ''
|
||||||
else:
|
else:
|
||||||
if x is components[-1]:
|
if x is components[-1]:
|
||||||
b, _, e = x.rpartition('.')
|
b, e = os.path.splitext(x)
|
||||||
if not b and e:
|
if e == '.': e = ''
|
||||||
b = e
|
|
||||||
e = ''
|
|
||||||
r = b[:-delta]+e
|
r = b[:-delta]+e
|
||||||
if r.startswith('.'): r = x[0]+r
|
if r.startswith('.'): r = x[0]+r
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user