From 3f98797f21e2207c23c3b71b6aa3e3f75853f3a9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Jan 2010 18:47:02 -0700 Subject: [PATCH] Fix #4570 (Windows: Error when adding PDF where metadata contains illegal path components) --- src/calibre/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index 4eeac6a159..347799de64 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -92,6 +92,8 @@ def sanitize_file_name(name, substitute='_', as_unicode=False): if as_unicode: one = one.decode(filesystem_encoding) one = one.replace('..', substitute) + if one.endswith('.'): + one = one[:-1]+'_' return one