From 00af6187a370d54a830e0240acb9c2276debd916 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 12 Oct 2013 18:26:21 -0400 Subject: [PATCH] Fix title of downloaded ebooks. --- src/calibre/gui2/ebook_download.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/ebook_download.py b/src/calibre/gui2/ebook_download.py index 1b2f8b38d0..9f678bd506 100644 --- a/src/calibre/gui2/ebook_download.py +++ b/src/calibre/gui2/ebook_download.py @@ -15,7 +15,7 @@ from calibre import browser, get_download_filename from calibre.ebooks import BOOK_EXTENSIONS from calibre.gui2 import Dispatcher from calibre.gui2.threaded_jobs import ThreadedJob -from calibre.ptempfile import PersistentTemporaryFile +from calibre.ptempfile import PersistentTemporaryDirectory from calibre.utils.filenames import ascii_filename class EbookDownload(object): @@ -56,7 +56,8 @@ class EbookDownload(object): cj.load(cookie_file) br.set_cookiejar(cj) with closing(br.open(url)) as r: - tf = PersistentTemporaryFile(suffix=filename) + temp_path = os.path.join(PersistentTemporaryDirectory(), filename) + tf = open(temp_path, 'w+b') tf.write(r.read()) dfilename = tf.name