Fix #3002 (Title can't have a colon in it)

This commit is contained in:
Kovid Goyal 2009-08-04 09:44:29 -06:00
parent be192a155a
commit 97c7dd07fe
2 changed files with 7 additions and 1 deletions

View File

@ -727,11 +727,14 @@ class Device(DeviceConfig, DevicePlugin):
if r.startswith('.'): r = x[0]+r if r.startswith('.'): r = x[0]+r
else: else:
r = x[:-delta] r = x[:-delta]
r = r.strip()
if not r:
r = x.strip()[0] if x.strip() else 'x'
if x is resizable[-1]: if x is resizable[-1]:
filepath = filepath.replace(os.sep+x, os.sep+r) filepath = filepath.replace(os.sep+x, os.sep+r)
else: else:
filepath = filepath.replace(os.sep+x+os.sep, os.sep+r+os.sep) filepath = filepath.replace(os.sep+x+os.sep, os.sep+r+os.sep)
filepath = filepath.replace(os.sep+os.sep, os.sep) filepath = filepath.replace(os.sep+os.sep, os.sep).strip()
newpath = os.path.dirname(filepath) newpath = os.path.dirname(filepath)
if not os.path.exists(newpath): if not os.path.exists(newpath):

View File

@ -54,6 +54,9 @@ def shorten_components_to(length, components):
if r.startswith('.'): r = x[0]+r if r.startswith('.'): r = x[0]+r
else: else:
r = x[:-delta] r = x[:-delta]
r = r.strip()
if not r:
r = x.strip()[0] if x.strip() else 'x'
ans.append(r) ans.append(r)
return ans return ans