Skip to content

Commit 6f08469

Browse files
committed
Validate downloaded file integrity and raise ValueError on hash mismatch
Enoch Mok <enochmokny@gmail.com>
1 parent 840861f commit 6f08469

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ def skip_if_downloading_fails():
180180
err_str = str(rt_e)
181181
if any(k in err_str for k in DOWNLOAD_FAIL_MSGS):
182182
raise unittest.SkipTest(f"Error while downloading: {rt_e}") from rt_e # incomplete download
183+
184+
raise rt_e
183185
except ValueError as v_e:
184186
if "hash check" in str(v_e):
185187
raise unittest.SkipTest(f"Hash value error while downloading: {v_e}") from v_e
186188

187-
raise rt_e
188-
189189

190190
SAMPLE_TIFF = "https://huggingface.co/datasets/MONAI/testing_data/resolve/main/CMU-1.tiff"
191191
SAMPLE_TIFF_HASH = "73a7e89bc15576587c3d68e55d9bf92f09690280166240b48ff4b48230b13bcd"

0 commit comments

Comments
 (0)