rarecoil/unwebpack-sourcemap

error in URL parsing

kristofpoppe opened this issue · 1 comments

Great tool, but keep receiving error when parsing. Seems like a slash is missing.

The initial map is detected, but then it fails, altough the jquery.min.js file is at that location....

c:\temp\portal>unwebpack_sourcemap.py --detect --make-directory --disable-ssl-verification https://192.168.1.210:4443 output
C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.1.210'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.1.210'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Detecting sourcemaps in HTML at https://192.168.1.210:4443/
C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.1.210'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Detected sourcemap at remote location https://192.168.1.210:4443//vendors.js.map
C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.1.210'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Detected sourcemap at remote location https://192.168.1.210:4443//main.js.map
Traceback (most recent call last):
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 382, in prepare_url
scheme, auth, host, port, path, query, fragment = parse_url(url)
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\url.py", line 394, in parse_url
return six.raise_from(LocationParseError(source_url), None)
File "", line 3, in raise_from
urllib3.exceptions.LocationParseError: Failed to parse: https://192.168.1.210:4443jquery.min.js

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\temp\portal\unwebpack_sourcemap.py", line 359, in
extractor.run()
File "C:\temp\portal\unwebpack_sourcemap.py", line 69, in run
detected_sourcemaps = self._detect_js_sourcemaps(self._target)
File "C:\temp\portal\unwebpack_sourcemap.py", line 128, in _detect_js_sourcemaps
js_data, last_target_uri = self._get_remote_data(next_target_uri)
File "C:\temp\portal\unwebpack_sourcemap.py", line 213, in _get_remote_data
result = requests.get(uri, verify=False)
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 528, in request
prep = self.prepare_request(req)
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 456, in prepare_request
p.prepare(
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 316, in prepare
self.prepare_url(url, params)
File "C:\Users\gebruiker\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 384, in prepare_url
raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: https://192.168.1.210:4443jquery.min.js

This is likely a regression due to some new PRs; I'll try to fix when possible but please feel free to issue a PR.