mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-27 01:24:28 +01:00
Fix #835
This commit is contained in:
parent
0b0346884f
commit
e74166ea09
1 changed files with 4 additions and 2 deletions
|
|
@ -80,14 +80,16 @@ def href(self, basedir=None):
|
|||
basedir = os.getcwd()
|
||||
if self.path is None:
|
||||
return self._href
|
||||
frag = '#'+quote(self.fragment) if self.fragment else ''
|
||||
f = self.fragment.encode('utf-8') if isinstance(self.fragment, unicode) else self.fragment
|
||||
frag = '#'+quote(f) if self.fragment else ''
|
||||
if self.path == basedir:
|
||||
return ''+frag
|
||||
try:
|
||||
rpath = relpath(self.path, basedir)
|
||||
except OSError: # On windows path and basedir could be on different drives
|
||||
rpath = self.path
|
||||
|
||||
if isinstance(rpath, unicode):
|
||||
rpath = rpath.encode('utf-8')
|
||||
return quote(rpath.replace(os.sep, '/'))+frag
|
||||
|
||||
def set_basedir(self, path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue