From a117d4c0b6cf1ef49bf9c509b50d2d38df97fa77 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 6 Oct 2013 08:36:46 +0530 Subject: [PATCH] HTMLZ Output: Fix long title causing error on windows HTMLZ Output: Fix long titles causing error when converting on windows. Fixes #1235815 [Long titles with possible invalid chars cause errors during convert](https://bugs.launchpad.net/calibre/+bug/1235815) --- src/calibre/ebooks/conversion/plugins/htmlz_output.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/plugins/htmlz_output.py b/src/calibre/ebooks/conversion/plugins/htmlz_output.py index 3fee896bf0..8a28694672 100644 --- a/src/calibre/ebooks/conversion/plugins/htmlz_output.py +++ b/src/calibre/ebooks/conversion/plugins/htmlz_output.py @@ -67,7 +67,8 @@ class HTMLZOutput(OutputFormatPlugin): fname = u'index' if opts.htmlz_title_filename: - fname = ascii_filename(unicode(oeb_book.metadata.title[0])) + from calibre.utils.filenames import shorten_components_to + fname = shorten_components_to(100, (ascii_filename(unicode(oeb_book.metadata.title[0])),))[0] with open(os.path.join(tdir, fname+u'.html'), 'wb') as tf: tf.write(html)