mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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)
This commit is contained in:
parent
a8d46f2f40
commit
c25e4c9fd6
@ -14,7 +14,7 @@ from PIL import Image
|
|||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
from calibre import browser, relpath, unicode_path
|
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.utils.filenames import ascii_filename
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
||||||
from calibre.ebooks.chardet import xml_to_unicode
|
from calibre.ebooks.chardet import xml_to_unicode
|
||||||
@ -213,6 +213,8 @@ class RecursiveFetcher(object):
|
|||||||
is_local = 5
|
is_local = 5
|
||||||
if is_local > 0:
|
if is_local > 0:
|
||||||
url = url[is_local:]
|
url = url[is_local:]
|
||||||
|
if iswindows and url.startswith('/'):
|
||||||
|
url = url[1:]
|
||||||
with open(url, 'rb') as f:
|
with open(url, 'rb') as f:
|
||||||
data = response(f.read())
|
data = response(f.read())
|
||||||
data.newurl = 'file:'+url # This is what mechanize does for
|
data.newurl = 'file:'+url # This is what mechanize does for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user