mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Catch all errors when using jsbeautifier.
Turns out there are some problems that can raise arbitrary exceptions.
This commit is contained in:
parent
a4f7728fad
commit
7d90eb65ed
@ -232,7 +232,11 @@ def view_urlencoded(hdrs, content):
|
||||
def view_javascript(hdrs, content):
|
||||
opts = jsbeautifier.default_options()
|
||||
opts.indent_size = 2
|
||||
res = jsbeautifier.beautify(content[:VIEW_CUTOFF], opts)
|
||||
try:
|
||||
res = jsbeautifier.beautify(content[:VIEW_CUTOFF], opts)
|
||||
except:
|
||||
# Bugs in jsbeautifier mean that it can trhow arbitrary errors.
|
||||
return None
|
||||
return "JavaScript", _view_text(res, len(content))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user