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/specify_cli/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ def collect_extension_events(project_root: Path) -> ResolvedEvents:
continue
try:
data = yaml.safe_load(ext_yml.read_text(encoding="utf-8")) or {}
except yaml.YAMLError:
except (UnicodeDecodeError, yaml.YAMLError):
continue
if not isinstance(data, dict):
continue
Expand Down
7 changes: 7 additions & 0 deletions tests/integrations/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ def test_invalid_yaml_skipped(self, tmp_path):
(ext_dir / "extension.yml").write_text("invalid: - - -", encoding="utf-8")
assert collect_extension_events(tmp_path) == {}

def test_non_utf8_manifest_skipped(self, tmp_path):
ext_dir = tmp_path / ".specify" / "extensions" / "my-ext"
ext_dir.mkdir(parents=True)
(ext_dir / "extension.yml").write_bytes(b"\xff\xfe")

assert collect_extension_events(tmp_path) == {}

def test_event_command_ref_canonicalized_via_manifest(self, tmp_path):
"""R1: events are read from a validated ExtensionManifest, so an
obsolete command ref (e.g. my-ext.boot) is canonicalized
Expand Down