Skip to content

Commit c446bf9

Browse files
authored
Merge pull request #14 from jlab/tornado_FetchFileFromCentralHandler_alsoDirs_debug
Tornado fetch file from central handler also dirs debug
2 parents f853f56 + 9441772 commit c446bf9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

qiita_pet/handlers/cloud_handlers/file_transfer_handlers.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,25 @@ def get(self, requested_filepath):
168168
# a whole directory
169169
to_download = BaseHandlerDownload._list_dir_files_nginx(
170170
self, filepath)
171+
172+
# fp_subdir is the part of the filepath the user requested,
173+
# without QIITA_BASE_DIR
174+
fp_subdir = os.path.relpath(filepath, basedatadir)
175+
176+
# above function adds filepath to located files, which is
177+
# different from the non-nginx version, e.g.
178+
# fp = /protected/job/2_test_folder/testdir/fileA.txt
179+
# fp_name = job/2_test_folder/testdir/fileA.txt
180+
# where "job/2_test_folder" is what user requested and
181+
# "testdir/fileA.txt" is a file within this directory.
182+
# When extracting by qiita_client, the "job/2_test_folder"
183+
# part would be added twice (one by user request, second by
184+
# unzipping). Therefore, we need to correct these names here:
185+
to_download = [
186+
(fp, os.path.relpath(fp_name, fp_subdir), fp_checksum,
187+
fp_size)
188+
for fp, fp_name, fp_checksum, fp_size
189+
in to_download]
171190
BaseHandlerDownload._write_nginx_file_list(self, to_download)
172191
BaseHandlerDownload._set_nginx_headers(
173192
self, filename_directory)

0 commit comments

Comments
 (0)