fix: oshash exception
This commit is contained in:
parent
0d3128948b
commit
39d66e5280
1 changed files with 4 additions and 0 deletions
|
@ -20,6 +20,10 @@ export async function oshash(
|
||||||
let hash = BigInt(st.size);
|
let hash = BigInt(st.size);
|
||||||
|
|
||||||
if (st.size < minFileSize){
|
if (st.size < minFileSize){
|
||||||
|
if (st.size < 8) {
|
||||||
|
fd.close();
|
||||||
|
throw new Error("Too short to hash");
|
||||||
|
}
|
||||||
// Although the original oshash algorithm should throw an exception,
|
// Although the original oshash algorithm should throw an exception,
|
||||||
// just applying the hash function.
|
// just applying the hash function.
|
||||||
const chunk = new Uint8Array(st.size);
|
const chunk = new Uint8Array(st.size);
|
||||||
|
|
Loading…
Add table
Reference in a new issue