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 ''
else:
if x is components[-1]:
b, _, e = x.rpartition('.')
if not b and e:
b = e
e = ''
b, e = os.path.splitext(x)
if e == '.': e = ''
r = b[:-delta]+e
if r.startswith('.'): r = x[0]+r
else: