From 2853c10e7eba1b52429a92ebf216a159bc85dee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Mon, 29 Apr 2024 23:30:43 +0200 Subject: [PATCH] Avoid utf8 encoding binary image files in getHash. --- img.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/img.js b/img.js index 5cd19b8..686eb56 100644 --- a/img.js +++ b/img.js @@ -365,11 +365,17 @@ class Image { if(fs.existsSync(this.src)) { let fileContents = this.getFileContents(); - // remove all newlines for hashing for better cross-OS hash compatibility (Issue #122) - let fileContentsStr = fileContents.toString(); - let firstFour = fileContentsStr.trim().slice(0, 5); - if(firstFour === "