diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index b9d3e3337..4773a1038 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1092,6 +1092,8 @@ class SearchEngineUrl(BaseType): except (KeyError, IndexError) as e: raise configexc.ValidationError( value, "may not contain {...} (use {{ and }} for literal {/})") + except ValueError as e: + raise configexc.ValidationError(value, str(e)) url = QUrl(value.replace('{}', 'foobar')) if not url.isValid(): diff --git a/tests/config/test_configtypes.py b/tests/config/test_configtypes.py index 6805d06c4..19491a0af 100644 --- a/tests/config/test_configtypes.py +++ b/tests/config/test_configtypes.py @@ -1502,6 +1502,7 @@ class TestSearchEngineUrl: ':{}', # invalid URL 'foo{bar}baz{}', # {bar} format string variable '{1}{}', # numbered format string variable + '{{}', # invalid format syntax ]) def test_validate_invalid(self, klass, val): with pytest.raises(configexc.ValidationError):