Skip to content

Commit e913300

Browse files
[ENG-11468] Improve output zip file name from DAZ (#486)
* Update zipfile name format in download_folder_as_zip method to include resource identifier * Update zipfile naming convention in download_folder_as_zip method to include resource identifier
1 parent 72dd843 commit e913300

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

tests/server/api/v1/test_metadata_mixin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ async def test_download_folder_as_zip(self, http_request, mock_stream):
233233
await handler.download_folder_as_zip()
234234

235235
assert handler._headers['Content-Type'] == 'application/zip'
236-
expected = 'attachment; filename="test_file.zip"; filename*=UTF-8\'\'test_file.zip'
236+
expected = 'attachment; filename="guid1-test_file.zip"; filename*=UTF-8\'\'guid1-test_file.zip'
237237
assert handler._headers['Content-Disposition'] == expected
238238

239239
handler.write_stream.assert_called_once_with(mock_stream)
@@ -249,7 +249,7 @@ async def test_download_folder_as_zip_root(self, http_request, mock_stream):
249249
await handler.download_folder_as_zip()
250250

251251
assert handler._headers['Content-Type'] == 'application/zip'
252-
expected = 'attachment; filename="MockProvider-archive.zip"; filename*=UTF-8\'\'MockProvider-archive.zip'
252+
expected = 'attachment; filename="guid1-MockProvider-archive.zip"; filename*=UTF-8\'\'guid1-MockProvider-archive.zip'
253253
assert handler._headers['Content-Disposition'] == expected
254254

255255
handler.write_stream.assert_called_once_with(mock_stream)

waterbutler/server/api/v1/provider/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def get_file_revisions(self):
127127
return self.write({'data': [r.json_api_serialized() for r in result]})
128128

129129
async def download_folder_as_zip(self):
130-
zipfile_name = self.path.name or f'{self.provider.NAME}-archive'
130+
zipfile_name = f'{self.path_kwargs.get("resource")}-{self.path.name}' if self.path.name else f'{self.path_kwargs.get("resource")}-{self.provider.NAME}-archive'
131131
self.set_header('Content-Type', 'application/zip')
132132
self.set_header('Content-Disposition', make_disposition(zipfile_name + '.zip'))
133133

0 commit comments

Comments
 (0)