Unverified Commit 9a7d1f2c authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #18583 from arash77/decode-archive-header

Fix Archive header encoding
parents e77f9289 5beb876b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -41,7 +41,8 @@ class ZipstreamWrapper:
    def get_headers(self) -> Dict[str, str]:
        headers = {}
        if self.archive_name:
            headers["Content-Disposition"] = f'attachment; filename="{self.archive_name}.zip"'
            archive_name = self.archive_name.encode("latin-1", "replace").decode("latin-1")
            headers["Content-Disposition"] = f'attachment; filename="{archive_name}.zip"'
        if self.upstream_mod_zip:
            headers["X-Archive-Files"] = "zip"
        else:
+8 −0
Original line number Diff line number Diff line
@@ -182,6 +182,14 @@ class TestDatasetCollectionsApi(ApiTestCase):
            namelist = archive.namelist()
            assert len(namelist) == 3, f"Expected 3 elements in [{namelist}]"

    def test_download_non_english_characters(self):
        with self.dataset_populator.test_history() as history_id:
            name = "دیتاست"
            payload = self.dataset_collection_populator.create_list_payload(history_id, name=name)
            hdca_id = self.dataset_populator.fetch(payload, wait=True).json()["outputs"][0]["id"]
            create_response = self._download_dataset_collection(history_id=history_id, hdca_id=hdca_id)
            self._assert_status_code_is(create_response, 200)

    @requires_new_user
    def test_hda_security(self):
        with self.dataset_populator.test_history(require_new=False) as history_id: