From e09434c65548230bfdce964264c0f9cc83aadd86 Mon Sep 17 00:00:00 2001 From: JonasKruckenberg Date: Tue, 30 Mar 2021 19:45:37 +0200 Subject: [PATCH] fix: cache key generation --- packages/core/src/util.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/core/src/util.ts b/packages/core/src/util.ts index 4ade9663..266aef97 100644 --- a/packages/core/src/util.ts +++ b/packages/core/src/util.ts @@ -2,16 +2,14 @@ import sharp from "sharp"; import { ImageConfig } from "./types"; import { createHash } from 'crypto' -export function loadImageFromDisk(path: string) { +export function loadImage(path: string) { return sharp(path) } -export function loadImageFromBuffer(buf: Buffer) { - return sharp(buf) -} - export function generateImageID(url:URL, config:ImageConfig) { - const baseURL = new URL(url.origin + url.pathname) + const baseURL = url.host + ? new URL(url.origin + url.pathname) + : new URL(url.protocol + url.pathname) return createHash('sha1').update(baseURL.href).update(JSON.stringify(config)).digest('hex') } \ No newline at end of file