From d27d61c30f8baf4411810fcd87fa78ec1561c6d8 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 12 Jan 2025 14:43:10 -0800 Subject: [PATCH] Fix regex for GL arg validation. --- src/classes/gl.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/classes/gl.ts b/src/classes/gl.ts index 1b190da..ab97502 100644 --- a/src/classes/gl.ts +++ b/src/classes/gl.ts @@ -167,7 +167,7 @@ export class NanoPowGl { */ static async search (hash: string, threshold: number = 0xfffffff8): Promise { if (NanoPowGl.#gl == null) throw new Error('WebGL 2 is required') - if (!/^[A-F-a-f0-9]{64}$/.test(hash)) throw new Error(`invalid_hash ${hash}`) + if (!/^[A-Fa-f0-9]{64}$/.test(hash)) throw new Error(`Invalid hash ${hash}`) if (typeof threshold !== 'number') throw new TypeError(`Invalid threshold ${threshold}`) if (this.#gl == null) throw new Error('WebGL 2 is required') @@ -206,8 +206,8 @@ export class NanoPowGl { */ static async validate (work: string, hash: string, threshold: number = 0xfffffff8): Promise { if (NanoPowGl.#gl == null) throw new Error('WebGL 2 is required') - if (!/^[A-F-a-f0-9]{16}$/.test(hash)) throw new Error(`invalid_hash ${work}`) - if (!/^[A-F-a-f0-9]{64}$/.test(hash)) throw new Error(`invalid_hash ${hash}`) + if (!/^[A-Fa-f0-9]{16}$/.test(work)) throw new Error(`Invalid work ${work}`) + if (!/^[A-Fa-f0-9]{64}$/.test(hash)) throw new Error(`Invalid hash ${hash}`) if (typeof threshold !== 'number') throw new TypeError(`Invalid threshold ${threshold}`) if (this.#gl == null) throw new Error('WebGL 2 is required') -- 2.34.1