Skip to content

Commit

Permalink
hash by image than by size
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianGonz97 committed Apr 29, 2024
1 parent 3819b35 commit 3fd2a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
diff --git a/dist/index.js b/dist/index.js
index b67e7418e853d74eb418e074f342ea5356c9e728..18de018234978f57910c8f36aa1c2ab2cf347c01 100644
index b67e7418e853d74eb418e074f342ea5356c9e728..fd5f8060e8f5f65ef60b0217d7907e8da4147442 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -19,8 +19,8 @@ async function generateImageID(url, config, imageBuffer) {
@@ -19,8 +19,7 @@ async function generateImageID(url, config, imageBuffer) {
// baseURL isn't a valid URL, but just a string used for an identifier
// use a relative path in the local case so that it's consistent across machines
const baseURL = new URL(url.protocol + path.relative(process.cwd(), url.pathname));
- const { mtime } = statSync(path.resolve(process.cwd(), decodeURIComponent(url.pathname)));
- return hash([baseURL.href, JSON.stringify(config), mtime.getTime().toString()]);
+ const { size } = statSync(path.resolve(process.cwd(), decodeURIComponent(url.pathname)));
+ return hash([baseURL.href, JSON.stringify(config), size.toString()]);
+ return hash([baseURL.href, JSON.stringify(config), imageBuffer]);
}
function hash(keyParts) {
let hash = createHash('sha1');
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3fd2a7a

Please sign in to comment.