mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Book: Handle books that contain links that are absolute filenames on windows (i.e. those that start with a drive letter)
This commit is contained in:
parent
547e9bdf5f
commit
583aa2bf4e
@ -364,9 +364,14 @@ class Container(object): # {{{
|
||||
else:
|
||||
base = os.path.dirname(self.name_to_abspath(base))
|
||||
purl = urlparse(href)
|
||||
if purl.scheme or not purl.path or purl.path.startswith('/'):
|
||||
if purl.scheme or not purl.path:
|
||||
return None
|
||||
href = urlunquote(purl.path)
|
||||
if href.startswith('/') or (len(href) > 1 and href[1] == ':' and 'a' <= href[0].lower() <= 'z'):
|
||||
# For paths that start with drive letter os.path.join(base, href)
|
||||
# will discard base and return href on windows, so we assume that
|
||||
# such paths are also absolute paths, on all platforms.
|
||||
return None
|
||||
fullpath = os.path.join(base, *href.split('/'))
|
||||
return self.abspath_to_name(fullpath)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user