File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1515 method (1 ,1 ) string
1616end
1717
18- assert(~stdlib .is_url(file ), " file_checksum does not accept URLs" )
18+ hash = [];
19+
20+ if stdlib .is_url(file ), return , end
1921
2022if strcmp(method , " sha256" ) || strcmp(method , " SHA256" )
2123 method = " SHA-256" ;
3032end
3133
3234fid = fopen(file , ' r' );
33- assert( fid > 0 , " could not open file %s " , file )
35+ if fid < 1 , return , end
3436
3537while ~feof(fid )
3638 % https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/security/MessageDigest.html#update(byte)
Original file line number Diff line number Diff line change @@ -65,6 +65,14 @@ function test_hash_text(tc)
6565
6666end
6767
68+
69+ function test_hash_empty(tc )
70+
71+ tc .verifyEmpty(stdlib .file_checksum(" file:///" , " sha256" ))
72+ tc .verifyEmpty(stdlib .file_checksum(" " , " sha256" ))
73+
74+ end
75+
6876end
6977
7078end
You can’t perform that action at this time.
0 commit comments