fix(squoosh): Fix wrong file path in rotation check (#7650)

This commit is contained in:
Erika 2023-07-14 15:52:14 +02:00 committed by GitHub
parent de5fbd3e4b
commit 7a6b48a1a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,9 @@ async function getRotationForEXIF(
inputBuffer: Buffer
): Promise<Operation | undefined> {
// check EXIF orientation data and rotate the image if needed
const meta = await imageMetadata(transform.src, inputBuffer);
const filePath = transform.src.slice('/@fs'.length);
const filePathURL = new URL('.' + filePath, 'file:');
const meta = await imageMetadata(filePathURL, inputBuffer);
if (!meta) return undefined;