diff --git a/lib/pbench/server/cache_manager.py b/lib/pbench/server/cache_manager.py index 8382460362..92bf8104f7 100644 --- a/lib/pbench/server/cache_manager.py +++ b/lib/pbench/server/cache_manager.py @@ -657,7 +657,7 @@ def get_inventory(self, path: str) -> Optional[JSONOBJECT]: """ if not path: info = { - "name": self.name, + "name": self.tarball_path.name, "type": CacheType.FILE, "stream": Inventory(self.tarball_path.open("rb"), None), } diff --git a/lib/pbench/test/functional/server/test_datasets.py b/lib/pbench/test/functional/server/test_datasets.py index 31fd96ee74..1f0c769f0a 100644 --- a/lib/pbench/test/functional/server/test_datasets.py +++ b/lib/pbench/test/functional/server/test_datasets.py @@ -766,6 +766,20 @@ def read_metadata(response: Response) -> JSONOBJECT: meta = read_metadata(response) assert meta == dataset.metadata["dataset.metalog"] + # Test that the content-disposition header has the proper full + # filename for the tarball itself. + response = server_client.get( + API.DATASETS_INVENTORY, + {"dataset": dataset.resource_id, "target": ""}, + ) + + # Werkzeug quotes filenames it thinks might be "suspect"; rather + # than try to reverse engineer the logic, check it piecemeal. + assert response.headers["content-disposition"].startswith( + "attachment; filename=" + ) + assert f"{dataset.name}.tar.xz" in response.headers["content-disposition"] + class TestUpdate: @pytest.mark.dependency(name="publish", depends=["index"], scope="session")