Advertisement
PypeBros

bugfix in calibre's "input.py"

Jan 5th, 2013
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. def resource_adder(self, link_, base=None):
  2.         link = self.urlnormalize(link_)
  3.         link, frag = self.urldefrag(link)
  4.         link = unquote(link).replace('/', os.sep)
  5.         self.oeb.log.debug('Adding', link)
  6.         if not link.strip():
  7.             return link_
  8.         try:
  9.             if base and not os.path.isabs(link):
  10.                 link = os.path.join(base, link)
  11.             link = os.path.abspath(link)
  12.             # PypeBros: how about URLs that have non-ASCII characters ?
  13.         except:
  14.             return link_
  15.         if not os.access(link, os.R_OK):
  16.             return link_
  17.         if os.path.isdir(link):
  18.             self.log.warn(link_, 'is a link to a directory. Ignoring.')
  19.             return link_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement