mirror of
https://github.com/sabnzbd/sabnzbd.git
synced 2025-12-24 00:00:12 -05:00
also disable argparse's auto-added help in the (io)nice parameters check (#3052)
This commit is contained in:
@@ -73,7 +73,7 @@ class ErrorCatchingArgumentParser(argparse.ArgumentParser):
|
||||
def clean_nice_ionice_parameters(value: str) -> ValidateResult:
|
||||
"""Verify that the passed parameters are not exploits"""
|
||||
if value:
|
||||
parser = ErrorCatchingArgumentParser()
|
||||
parser = ErrorCatchingArgumentParser(add_help=False)
|
||||
|
||||
# Nice parameters
|
||||
parser.add_argument("-n", "--adjustment", type=int)
|
||||
|
||||
@@ -88,6 +88,10 @@ class TestValidators:
|
||||
assert_blocked("echo 'how;now;brown;cow'")
|
||||
assert_blocked("-c'echo'")
|
||||
assert_blocked("--classdata=;/bin/echo")
|
||||
assert_blocked("-h")
|
||||
assert_blocked("--help")
|
||||
assert_blocked("-h -c1")
|
||||
assert_blocked("-c1 --help")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"setting, is_correct_win, is_correct_unix",
|
||||
|
||||
Reference in New Issue
Block a user