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/bundles/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _local_manifest_source(arg: str):
raise BundlerError(f"No bundle.yml found in '{candidate}'.")
return BundleManifest.from_file(manifest_path)

if candidate.suffix == ".zip":
if candidate.suffix.lower() == ".zip":
import yaml as _yaml

from .._download_security import open_zip_bounded, read_zip_member_limited
Expand Down
27 changes: 27 additions & 0 deletions tests/specify_cli/bundles/test_command_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,33 @@ def test_local_firstparty_bundle_installs_bundled_components_offline(
assert registry["workflows"][bundle_id]["version"] == "1.0.0"


@pytest.mark.parametrize("filename", ["demo-bundle.zip", "DEMO-BUNDLE.ZIP"])
def test_local_zip_artifact_installs_regardless_of_extension_case(
project: Path, filename: str
):
from specify_cli.bundles.records import load_records

artifact = project / filename
with zipfile.ZipFile(artifact, "w") as archive:
archive.writestr("bundle.yml", yaml.safe_dump(valid_manifest_dict(provides={})))

result = runner.invoke(app, ["bundle", "install", str(artifact), "--offline"])

assert result.exit_code == 0, result.output
assert [record.bundle_id for record in load_records(project)] == ["demo-bundle"]


def test_local_uppercase_zip_without_manifest_is_rejected(project: Path):
artifact = project / "broken.ZIP"
with zipfile.ZipFile(artifact, "w") as archive:
archive.writestr("README.md", "No manifest")

result = runner.invoke(app, ["bundle", "install", str(artifact), "--offline"])

assert result.exit_code == 1
assert "does not contain a bundle.yml" in " ".join(result.output.split())


def test_local_bundle_rejects_mismatched_bundled_workflow_pin_offline(project: Path):
bundle_dir = project / "mismatched-workflow-pin"
(bundle_dir / "bundle.yml").parent.mkdir()
Expand Down