[cookies] Make browser names case insensitive

This commit is contained in:
pukkandan 2021-09-11 17:49:03 +05:30
parent 67ad7759af
commit ca46b94134
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
3 changed files with 3 additions and 2 deletions

View File

@ -248,7 +248,7 @@ def _real_main(argv=None):
if opts.cookiesfrombrowser is not None:
opts.cookiesfrombrowser = [
part.strip() or None for part in opts.cookiesfrombrowser.split(':', 1)]
if opts.cookiesfrombrowser[0] not in SUPPORTED_BROWSERS:
if opts.cookiesfrombrowser[0].lower() not in SUPPORTED_BROWSERS:
parser.error('unsupported browser specified for cookies')
if opts.date is not None:

View File

@ -748,6 +748,7 @@ def _is_path(value):
def _parse_browser_specification(browser_name, profile=None):
browser_name = browser_name.lower()
if browser_name not in SUPPORTED_BROWSERS:
raise ValueError(f'unsupported browser: "{browser_name}"')
if profile is not None and _is_path(profile):

View File

@ -1128,7 +1128,7 @@ def parseOpts(overrideArguments=None):
'You can specify the user profile name or directory using '
'"BROWSER:PROFILE_NAME" or "BROWSER:PROFILE_PATH". '
'If no profile is given, the most recently accessed one is used'.format(
'|'.join(sorted(SUPPORTED_BROWSERS)))))
', '.join(sorted(SUPPORTED_BROWSERS)))))
filesystem.add_option(
'--no-cookies-from-browser',
action='store_const', const=None, dest='cookiesfrombrowser',