Fix regression in filename shortening that caused loss of filename extension

This commit is contained in:
Kovid Goyal 2010-09-11 11:54:54 -06:00
parent fc8bcdc6f0
commit 3766f34aab

View File

@ -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: