diff options
-rw-r--r-- | manifest_xml.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index f2ac77a5..d496337c 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -80,18 +80,20 @@ class _XmlRemote(object): | |||
80 | def _resolveFetchUrl(self): | 80 | def _resolveFetchUrl(self): |
81 | url = self.fetchUrl.rstrip('/') | 81 | url = self.fetchUrl.rstrip('/') |
82 | manifestUrl = self.manifestUrl.rstrip('/') | 82 | manifestUrl = self.manifestUrl.rstrip('/') |
83 | p = manifestUrl.startswith('persistent-http') | 83 | # urljoin will gets confused over quite a few things. The ones we care |
84 | if p: | 84 | # about here are: |
85 | manifestUrl = manifestUrl[len('persistent-'):] | 85 | # * no scheme in the base url, like <hostname:port> |
86 | 86 | # * persistent-https:// | |
87 | # urljoin will get confused if there is no scheme in the base url | 87 | # We handle this by replacing these with obscure protocols |
88 | # ie, if manifestUrl is of the form <hostname:port> | 88 | # and then replacing them with the original when we are done. |
89 | # gopher -> <none> | ||
90 | # wais -> persistent-https | ||
89 | if manifestUrl.find(':') != manifestUrl.find('/') - 1: | 91 | if manifestUrl.find(':') != manifestUrl.find('/') - 1: |
90 | manifestUrl = 'gopher://' + manifestUrl | 92 | manifestUrl = 'gopher://' + manifestUrl |
93 | manifestUrl = re.sub(r'^persistent-https://', 'wais://', manifestUrl) | ||
91 | url = urllib.parse.urljoin(manifestUrl, url) | 94 | url = urllib.parse.urljoin(manifestUrl, url) |
92 | url = re.sub(r'^gopher://', '', url) | 95 | url = re.sub(r'^gopher://', '', url) |
93 | if p: | 96 | url = re.sub(r'^wais://', 'persistent-https://', url) |
94 | url = 'persistent-' + url | ||
95 | return url | 97 | return url |
96 | 98 | ||
97 | def ToRemoteSpec(self, projectName): | 99 | def ToRemoteSpec(self, projectName): |