diff --git a/src/redfetch/config.py b/src/redfetch/config.py index 6419d59..31f52dd 100644 --- a/src/redfetch/config.py +++ b/src/redfetch/config.py @@ -121,7 +121,7 @@ def normalize_paths_in_dict(data, parent_key=None): elif key in ['default_path', 'custom_path'] and isinstance(value, str): normalized_value = os.path.normpath(value) if value else value parent_key_int = int(parent_key) if isinstance(parent_key, str) and parent_key.isdigit() else parent_key - if parent_key_int not in EQMAPS_MAP: + if parent_key_int not in EQMAPS_MAP and os.path.isabs(normalized_value): validate_no_eqgame(normalized_value) data[key] = normalized_value elif isinstance(data, list): diff --git a/tests/test_config_validation.py b/tests/test_config_validation.py new file mode 100644 index 0000000..93427b8 --- /dev/null +++ b/tests/test_config_validation.py @@ -0,0 +1,33 @@ +from dynaconf import ValidationError +import pytest + +from redfetch.config import normalize_paths_in_dict + + +def test_special_resource_relative_path_skips_eqgame_validation(): + data = { + "1974": { + "default_path": "VanillaMQ_LIVE", + } + } + + normalized = normalize_paths_in_dict(data) + + assert normalized["1974"]["default_path"] == "VanillaMQ_LIVE" + + +def test_special_resource_absolute_path_still_rejects_eqgame_parent(tmp_path): + eq_root = tmp_path / "EverQuest" + vv_path = eq_root / "VanillaMQ_LIVE" + eq_root.mkdir() + vv_path.mkdir() + (eq_root / "eqgame.exe").write_text("", encoding="utf-8") + + data = { + "1974": { + "default_path": str(vv_path), + } + } + + with pytest.raises(ValidationError, match=r"contains eqgame\.exe"): + normalize_paths_in_dict(data)