From 3b1d24a90775f11ac872fcceed2c1587d6c1fe2b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Feb 2014 07:51:36 +0530 Subject: [PATCH] Workaround broken file chooser dialog on Ubuntu that does not auto-insert the specified extension. Fixes #1275125 [Edit book: cannot create new empty book when extension is not specified in the file](https://bugs.launchpad.net/calibre/+bug/1275125) --- src/calibre/gui2/tweak_book/boss.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index 508d71fbe8..40dfdbcaa8 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -156,10 +156,12 @@ class Boss(QObject): return d = NewBook(self.gui) if d.exec_() == d.Accepted: - fmt = d.fmt + fmt = d.fmt.lower() path = choose_save_file(self.gui, 'edit-book-new-book', _('Choose file location'), filters=[(fmt.upper(), (fmt,))], all_files=False) if path is not None: + if not path.lower().endswith('.' + fmt): + path = path + '.' + fmt from calibre.ebooks.oeb.polish.create import create_book create_book(d.mi, path, fmt=fmt) self.open_book(path=path)