Skip to content

Commit 947903e

Browse files
authored
fix #2988 (#3015)
1 parent 3252ca2 commit 947903e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

qiita_db/test/test_artifact.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,11 +1065,19 @@ def test_delete(self):
10651065
qdb.artifact.Artifact(test.id)
10661066

10671067
def test_delete_with_html(self):
1068+
1069+
# creating a single file html_summary
10681070
fd, html_fp = mkstemp(suffix=".html")
10691071
close(fd)
10701072
self.filepaths_root.append((html_fp, 'html_summary'))
10711073
self._clean_up_files.append(html_fp)
10721074

1075+
# creating a folder with a file for html_summary_dir
1076+
summary_dir = mkdtemp()
1077+
open(join(summary_dir, 'index.html'), 'w').write('this is a test')
1078+
self.filepaths_root.append((summary_dir, 'html_summary_dir'))
1079+
self._clean_up_files.append(summary_dir)
1080+
10731081
test = qdb.artifact.Artifact.create(
10741082
self.filepaths_root, "FASTQ", prep_template=self.prep_template)
10751083

@@ -1085,6 +1093,7 @@ def test_delete_with_html(self):
10851093
qdb.artifact.Artifact(test.id)
10861094

10871095
self.assertFalse(exists(join(uploads_fp, basename(html_fp))))
1096+
self.assertFalse(exists(join(uploads_fp, basename(summary_dir))))
10881097

10891098
def test_delete_with_jobs(self):
10901099
test = qdb.artifact.Artifact.create(

qiita_db/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ def move_filepaths_to_upload_folder(study_id, filepaths):
949949
for x in filepaths:
950950
qdb.sql_connection.TRN.add(sql, [x['fp_id']])
951951

952-
if x['fp_type'] == 'html_summary':
952+
if x['fp_type'] in ('html_summary', 'html_summary_dir'):
953953
_rm_files(qdb.sql_connection.TRN, x['fp'])
954954
else:
955955
destination = path_builder(basename(x['fp']))

0 commit comments

Comments
 (0)