From c25e4c9fd6b6451577297f4e65127948891500c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Mar 2012 07:52:58 +0530 Subject: [PATCH] Fix regression in 0.8.41 that caused file:/// URLs to stop working in the news download system on windows. Fixes #955581 (Calibre now requires improper file url for local files) --- src/calibre/web/fetch/simple.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index 9993d9a3db..03ce64a750 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -14,7 +14,7 @@ from PIL import Image from cStringIO import StringIO from calibre import browser, relpath, unicode_path -from calibre.constants import filesystem_encoding +from calibre.constants import filesystem_encoding, iswindows from calibre.utils.filenames import ascii_filename from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag from calibre.ebooks.chardet import xml_to_unicode @@ -213,6 +213,8 @@ class RecursiveFetcher(object): is_local = 5 if is_local > 0: url = url[is_local:] + if iswindows and url.startswith('/'): + url = url[1:] with open(url, 'rb') as f: data = response(f.read()) data.newurl = 'file:'+url # This is what mechanize does for