diff --git a/cypress/integration/vault.spec.js b/cypress/integration/vault.spec.js --- a/cypress/integration/vault.spec.js +++ b/cypress/integration/vault.spec.js @@ -292,7 +292,7 @@ fixture: `${this.revision.replace(/:/g, '_')}.git.tar`, headers: { 'Content-disposition': `attachment; filename=${this.revision.replace(/:/g, '_')}.git.tar`, - 'Content-Type': 'application/gzip' + 'Content-Type': 'application/x-tar' } }).as('fetchCookedArchive'); @@ -506,7 +506,7 @@ fixture: `${this.revision.replace(/:/g, '_')}.git.tar`, headers: { 'Content-disposition': `attachment; filename=${this.revision.replace(/:/g, '_')}.git.tar`, - 'Content-Type': 'application/gzip' + 'Content-Type': 'application/x-tar' } }).as('fetchCookedArchive'); diff --git a/swh/web/api/views/vault.py b/swh/web/api/views/vault.py --- a/swh/web/api/views/vault.py +++ b/swh/web/api/views/vault.py @@ -173,7 +173,7 @@ :param string swhid: the SWHID of the object to cook - :resheader Content-Type: application/octet-stream + :resheader Content-Type: application/gzip :statuscode 200: no error :statuscode 404: requested directory did not receive any cooking @@ -337,7 +337,7 @@ :param string rev_id: the revision's sha1 identifier - :resheader Content-Type: application/octet-stream + :resheader Content-Type: application/gzip :statuscode 200: no error :statuscode 404: requested directory did not receive any cooking @@ -474,7 +474,7 @@ :param string swhid: the revision's permanent identifier - :resheader Content-Type: application/octet-stream + :resheader Content-Type: application/x-tar :statuscode 200: no error :statuscode 404: requested directory did not receive any cooking @@ -489,7 +489,7 @@ request=request, ) fname = "{}.git.tar".format(swhid) - response = HttpResponse(res, content_type="application/gzip") + response = HttpResponse(res, content_type="application/x-tar") response["Content-disposition"] = "attachment; filename={}".format( fname.replace(":", "_") ) diff --git a/swh/web/tests/api/views/test_vault.py b/swh/web/tests/api/views/test_vault.py --- a/swh/web/tests/api/views/test_vault.py +++ b/swh/web/tests/api/views/test_vault.py @@ -32,10 +32,10 @@ def test_api_vault_cook(api_client, mocker, directory, revision): mock_archive = mocker.patch("swh.web.api.views.vault.archive") - for bundle_type, swhid in ( - ("flat", f"swh:1:dir:{directory}"), - ("gitfast", f"swh:1:rev:{revision}"), - ("git_bare", f"swh:1:rev:{revision}"), + for bundle_type, swhid, content_type, in ( + ("flat", f"swh:1:dir:{directory}", "application/gzip"), + ("gitfast", f"swh:1:rev:{revision}", "application/gzip"), + ("git_bare", f"swh:1:rev:{revision}", "application/x-tar"), ): fetch_url = reverse( @@ -74,7 +74,7 @@ ) rv = check_http_get_response(api_client, fetch_url, status_code=200) - assert rv["Content-Type"] == "application/gzip" + assert rv["Content-Type"] == content_type assert rv.content == stub_fetch mock_archive.vault_fetch.assert_called_with( bundle_type, CoreSWHID.from_string(swhid)