Skip to content

Commit 2cd8b05

Browse files
authored
support sites with omitted protocol portion
Some sites omit the protocol portion (http:, https:) from URLs to prevent mixed content issues and result in minor file size savings. Like this: `<script src="//s1.hdslb.com/bfs/static/jinkela/international-home/1.international-home.a4f08ae57dcc95e7a9ea5ceacc3cefdc9831407a.js" defer=""></script>`
1 parent 75ae1fc commit 2cd8b05

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

SourceMapX.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ def _detect_js_sourcemaps(self, uri):
139139
next_target_uri = source
140140
else:
141141
current_uri = urlparse(uri)
142-
built_uri = current_uri.scheme + "://" + current_uri.netloc + source
143-
next_target_uri = built_uri
142+
if source.startswith('//'):
143+
next_target_uri = current_uri.scheme + ':' + source
144+
else:
145+
built_uri = current_uri.scheme + "://" + current_uri.netloc + source
146+
next_target_uri = built_uri
144147

145148
js_data = self._get_remote_data(next_target_uri)
146149
if js_data:
@@ -395,4 +398,4 @@ def readfile(pfile):
395398
extractor = SourceMapExtractor(target,args.output,args.method)
396399
extractor.run()
397400
#extractor = SourceMapExtractor(vars(args))
398-
#extractor.run()
401+
#extractor.run()

0 commit comments

Comments
 (0)