mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
unminify: Fix source map extraction for hash-named files.
Apparently, our old unminify logic relied on the fact that the filenames displayed in tracebacks were of the form "app.js" (and the `app.js` copy of the source map in the appropriate `/home/zulip/deployments/`). The correct behavior is to just look up the source map for the appropriate hash-named `app.a40806b10565c1dee5bf.js` type file. We fix this with a few small tweaks to the regular expressions. I wish this file had reasonable unit tests.
This commit is contained in:
@@ -30,10 +30,10 @@ class SourceMap:
|
||||
out = '' # type: str
|
||||
for ln in stacktrace.splitlines():
|
||||
out += ln + '\n'
|
||||
match = re.search(r'/static/(?:webpack-bundles|min)/(.+)(\.[\.0-9a-f]+)\.js:(\d+):(\d+)', ln)
|
||||
match = re.search(r'/static/(?:webpack-bundles|min)/(.+)(\.[\.0-9a-f]+\.js):(\d+):(\d+)', ln)
|
||||
if match:
|
||||
# Get the appropriate source map for the minified file.
|
||||
minified_src = match.groups()[0] + '.js'
|
||||
minified_src = match.groups()[0] + match.groups()[1]
|
||||
index = self._index_for(minified_src)
|
||||
|
||||
gen_line, gen_col = list(map(int, match.groups()[2:4]))
|
||||
|
||||
Reference in New Issue
Block a user