Fix #4570 (Windows: Error when adding PDF where metadata contains illegal path components)

This commit is contained in:
Kovid Goyal 2010-01-14 18:47:02 -07:00
parent 0377f9b43c
commit 3f98797f21

View File

@ -92,6 +92,8 @@ def sanitize_file_name(name, substitute='_', as_unicode=False):
if as_unicode: if as_unicode:
one = one.decode(filesystem_encoding) one = one.decode(filesystem_encoding)
one = one.replace('..', substitute) one = one.replace('..', substitute)
if one.endswith('.'):
one = one[:-1]+'_'
return one return one