Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/redfetch/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
33 changes: 33 additions & 0 deletions tests/test_config_validation.py
Original file line number Diff line number Diff line change
@@ -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)