diff --git a/readthedocs/config/config.py b/readthedocs/config/config.py index 244135277eb..16e55fffab5 100644 --- a/readthedocs/config/config.py +++ b/readthedocs/config/config.py @@ -1085,10 +1085,13 @@ def _get_extra_key(self, value): } Will return `['key', 'name']`. + + Ignores keys that start with ``x-``. """ - if isinstance(value, dict) and value: - key_name = next(iter(value)) - return [key_name] + self._get_extra_key(value[key_name]) + if isinstance(value, dict): + key_name = next((k for k in value if not k.startswith('x-')), None) + if key_name is not None: + return [key_name] + self._get_extra_key(value[key_name]) return [] @property diff --git a/readthedocs/config/tests/test_config.py b/readthedocs/config/tests/test_config.py index 3ee20d1653c..2251b58bd47 100644 --- a/readthedocs/config/tests/test_config.py +++ b/readthedocs/config/tests/test_config.py @@ -1966,6 +1966,7 @@ def test_strict_validation_pops_all_keys(self): ({'one': {'two': 3}}, ['one', 'two']), (OrderedDict([('one', 1), ('two', 2)]), ['one']), (OrderedDict([('one', {'two': 2}), ('three', 3)]), ['one', 'two']), + ({'one': 1, 'x-two': 2}, ['one']), ], ) def test_get_extra_key(self, value, expected):