diff --git a/api/jobs/rules.py b/api/jobs/rules.py index 8e7d19a34f2a3eaa75294072688a4f1bbf4175e7..85900e71388db52c42b2570f7e75d46700982490 100644 --- a/api/jobs/rules.py +++ b/api/jobs/rules.py @@ -93,7 +93,7 @@ def eval_match(match_type, match_param, file_, container): elif match_type == 'container.has-type': for c_file in container['files']: c_file_type = c_file.get('type') - if c_file_type and match_param.lower() == c_file_type.lower() + if c_file_type and match_param.lower() == c_file_type.lower(): return True return False diff --git a/test/integration_tests/python/test_rules.py b/test/integration_tests/python/test_rules.py index 66cf0a7d6fc52db0f806485e43ba354292f42faf..cecbb0ec53d74bd1bda923a509cb59d5e3d1b8a4 100644 --- a/test/integration_tests/python/test_rules.py +++ b/test/integration_tests/python/test_rules.py @@ -376,6 +376,11 @@ def test_rules(randstr, data_builder, file_form, as_root, as_admin, with_user, a ) assert r.ok + # Ensure file without type or measurements does not cause issues with rule evalution + # upload file that matches only part of rule + r = as_admin.post('/projects/' + project + '/files', files=file_form('test3.notreal')) + assert r.ok + # test that only one job was created via rule gear_jobs = [job for job in api_db.jobs.find({'gear_id': gear_2})] assert len(gear_jobs) == 2