Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions qiita_pet/handlers/cloud_handlers/file_transfer_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,25 @@ def get(self, requested_filepath):
# a whole directory
to_download = BaseHandlerDownload._list_dir_files_nginx(
self, filepath)

# fp_subdir is the part of the filepath the user requested,
# without QIITA_BASE_DIR
fp_subdir = os.path.relpath(filepath, basedatadir)

# above function adds filepath to located files, which is
# different from the non-nginx version, e.g.
# fp = /protected/job/2_test_folder/testdir/fileA.txt
# fp_name = job/2_test_folder/testdir/fileA.txt
# where "job/2_test_folder" is what user requested and
# "testdir/fileA.txt" is a file within this directory.
# When extracting by qiita_client, the "job/2_test_folder"
# part would be added twice (one by user request, second by
# unzipping). Therefore, we need to correct these names here:
to_download = [
(fp, os.path.relpath(fp_name, fp_subdir), fp_checksum,
fp_size)
for fp, fp_name, fp_checksum, fp_size
in to_download]
BaseHandlerDownload._write_nginx_file_list(self, to_download)
BaseHandlerDownload._set_nginx_headers(
self, filename_directory)
Expand Down
Loading