Skip to content

Instantly share code, notes, and snippets.

@antdking
Last active August 29, 2015 14:06
Show Gist options
  • Save antdking/ec5295560d32ef742089 to your computer and use it in GitHub Desktop.
Save antdking/ec5295560d32ef742089 to your computer and use it in GitHub Desktop.
diff --git a/manifest_xml.py b/manifest_xml.py
index fdc3177..05d4f3c 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -90,12 +90,15 @@ class _XmlRemote(object):
# and then replacing them with the original when we are done.
# gopher -> <none>
# wais -> persistent-https
if manifestUrl.find(':') != manifestUrl.find('/') - 1:
manifestUrl = 'gopher://' + manifestUrl
- manifestUrl = re.sub(r'^persistent-https://', 'wais://', manifestUrl)
+ if manifestUrl.startswith('persistent-https://'):
+ urllib.parse.uses_netloc.append('persistent-https')
+ urllib.parse.uses_relative.append('persistent-https')
url = urllib.parse.urljoin(manifestUrl, url)
+ if url.startswith('gopher://'):
+ url = url[-9:]
- url = re.sub(r'^gopher://', '', url)
- url = re.sub(r'^wais://', 'persistent-https://', url)
return url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment