From d147f566466eeea72d7229449b3b805e8cf0a084 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Sep 2009 16:27:38 -0600 Subject: [PATCH] Fix #3417 (Receipt - FTD (Financial Time Deutschland) => empty Receipt) --- setup/installer/windows/calibre/calibre.mpi | 2 +- src/calibre/web/fetch/simple.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/setup/installer/windows/calibre/calibre.mpi b/setup/installer/windows/calibre/calibre.mpi index 3a7d0d2309..860eae62f2 100644 --- a/setup/installer/windows/calibre/calibre.mpi +++ b/setup/installer/windows/calibre/calibre.mpi @@ -409,7 +409,6 @@ File ::C3466B70-23C3-31C9-3B4F-1B3B56E4D013 -name markdown-calibre.exe.local -pa File ::6ED1C675-C4D5-6BFF-7C8A-9AB4BF39D00C -name _hashlib.pyd -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::21F7F333-3063-71E3-85F5-5C88584B15CC -name IM_MOD_RL_tga_.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::26741B21-C241-E100-8BB1-8B679BC3E662 -name configure.xml -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 -File ::7D491E89-C6D3-1E6E-F4BD-8E55260FE33E -name libexpat.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::476CB977-5155-D56F-26CA-EB243AEBBA99 -name unrar.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::2E2A9EDA-5386-444E-8479-557386794552 -name IM_MOD_RL_uil_.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::D3301E15-1B1A-E2AB-1B04-30A601B3FB44 -name IM_MOD_RL_cut_.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 @@ -569,6 +568,7 @@ File ::C9967023-A4C2-856C-1D90-DC710105EBCD -name jpeg62.dll -parent 8E5D85A4-76 File ::B1560042-C99B-9803-552E-21C15F0DFD85 -type dir -name resources -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::DEDE8BE9-D712-2770-A1EC-7E9164CC6D29 -name libpng12.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 File ::2A8619DB-B715-CBF8-E711-C6B0C5FD9EF4 -name _elementtree.pyd -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 +File ::0924A77D-EDD2-FF33-560A-983053637A47 -name libexpat-1.dll -parent 8E5D85A4-7608-47A1-CF7C-309060D5FF40 Component ::F6829AB7-9F66-4CEE-CA0E-21F54C6D3609 -setup Install -active Yes -platforms {AIX-ppc FreeBSD-4-x86 FreeBSD-x86 HPUX-hppa Linux-x86 Solaris-sparc Windows FreeBSD-5-x86 FreeBSD-6-x86 FreeBSD-7-x86 Linux-x86_64 Solaris-x86} -name Main -parent Components SetupType ::D9ADE41C-B744-690C-2CED-CF826BF03D2E -setup Install -active Yes -platforms {AIX-ppc FreeBSD-4-x86 FreeBSD-x86 HPUX-hppa Linux-x86 Solaris-sparc Windows FreeBSD-5-x86 FreeBSD-6-x86 FreeBSD-7-x86 Linux-x86_64 Solaris-x86} -name Typical -parent SetupTypes diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index fdf4e81095..27ac735053 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -41,10 +41,16 @@ class closing(object): _browser_lock = RLock() +bad_url_counter = 0 def basename(url): - parts = urlparse.urlsplit(url) - path = url2pathname(parts.path) - res = os.path.basename(path) + try: + parts = urlparse.urlsplit(url) + path = url2pathname(parts.path) + res = os.path.basename(path) + except: + global bad_url_counter + bad_url_counter += 1 + return 'bad_url_%d.html'%bad_url_counter if not os.path.splitext(res)[1]: return 'index.html' return res