From d1bbd2c498f528d6d7bd53fb65f5909987bb8573 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Sep 2010 19:34:30 -0600 Subject: [PATCH] Fix #6764 (maximum_recursion_depth on shorten_components_to (function recursively calls itself on the same data)) --- src/calibre/utils/filenames.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/utils/filenames.py b/src/calibre/utils/filenames.py index 01eb9f30a0..9fd57ab53c 100644 --- a/src/calibre/utils/filenames.py +++ b/src/calibre/utils/filenames.py @@ -55,6 +55,9 @@ def shorten_components_to(length, components): else: if x is components[-1]: b, _, e = x.rpartition('.') + if not b and e: + b = e + e = '' r = b[:-delta]+e if r.startswith('.'): r = x[0]+r else: