diff --git a/functions/api/uploads/[[id]].ts b/functions/api/uploads/[[id]].ts index 4745958..c909418 100644 --- a/functions/api/uploads/[[id]].ts +++ b/functions/api/uploads/[[id]].ts @@ -5,7 +5,7 @@ export async function onRequestGet(context: RequestContext) { ).toString()}`; const signingKey = await crypto.subtle.importKey( "raw", - new TextEncoder().encode(atob(context.env.URL_SIGNING_KEY)), + Uint8Array.from(atob(context.env.URL_SIGNING_KEY), (c) => c.charCodeAt(0)), { hash: "SHA-1", name: "HMAC" }, false, ["sign"], @@ -17,7 +17,10 @@ export async function onRequestGet(context: RequestContext) { ); return Response.redirect( - `${unsignedURL}&Signature=${btoa(new TextDecoder().decode(signature)) + `${unsignedURL}&Signature=${btoa( + // @ts-expect-error + String.fromCodePoint(...signature), + ) .replaceAll("+", "-") .replaceAll("/", "_") .replaceAll("=", "")}`,