Skip to content

Commit

Permalink
Merge pull request #18583 from arash77/decode-archive-header
Browse files Browse the repository at this point in the history
Fix Archive header encoding
  • Loading branch information
mvdbeek authored Jul 23, 2024
2 parents e77f928 + 5beb876 commit 9a7d1f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/galaxy/util/zipstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def response(self) -> Iterator[bytes]:
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:
Expand Down
8 changes: 8 additions & 0 deletions lib/galaxy_test/api/test_dataset_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ def test_list_list_list_download(self):
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:
Expand Down

0 comments on commit 9a7d1f2

Please sign in to comment.