mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-05-08 02:28:50 +08:00
Catch all errors when using jsbeautifier.
Turns out there are some problems that can raise arbitrary exceptions.
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user