mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-02 00:05:27 +00:00
Merge pull request #3801 from mitmproxy/issue-3794
Improve command detection heuristics
This commit is contained in:
commit
fdc0864b2d
@ -149,9 +149,10 @@ class CommandManager:
|
||||
if not i.startswith("__"):
|
||||
o = getattr(addon, i)
|
||||
try:
|
||||
is_command = hasattr(o, "command_name")
|
||||
# hasattr is not enough, see https://github.com/mitmproxy/mitmproxy/issues/3794
|
||||
is_command = isinstance(getattr(o, "command_name", None), str)
|
||||
except Exception:
|
||||
pass # hasattr may raise if o implements __getattr__.
|
||||
pass # getattr may raise if o implements __getattr__.
|
||||
else:
|
||||
if is_command:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user