From cd306bc8a157d5b309a5009d36bd54f713477dd2 Mon Sep 17 00:00:00 2001 From: Aleksandr Kadykov Date: Wed, 27 Nov 2024 08:49:50 +0000 Subject: [PATCH 1/2] Fix JPEG image size determination --- .changeset/bright-pants-trade.md | 5 +++++ .../astro/src/assets/utils/vendor/image-size/types/jpg.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/bright-pants-trade.md diff --git a/.changeset/bright-pants-trade.md b/.changeset/bright-pants-trade.md new file mode 100644 index 000000000000..00267ad71b27 --- /dev/null +++ b/.changeset/bright-pants-trade.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix JPEG image size determination diff --git a/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts b/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts index 1ccf2d99f1b6..11a1e0b43d3a 100644 --- a/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts +++ b/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts @@ -122,7 +122,7 @@ export const JPG: IImage = { // Every JPEG block must begin with a 0xFF if (input[i] !== 0xff) { - input = input.slice(1) + input = input.slice(i) continue } From 6c4ad2154ce2cd8846d28a204a446d1e9588ef2b Mon Sep 17 00:00:00 2001 From: Aleksandr Kadykov Date: Wed, 27 Nov 2024 11:55:47 +0000 Subject: [PATCH 2/2] Add note about upstream fix in image-size vendored module --- packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts b/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts index 11a1e0b43d3a..763cfc98c096 100644 --- a/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts +++ b/packages/astro/src/assets/utils/vendor/image-size/types/jpg.ts @@ -122,6 +122,7 @@ export const JPG: IImage = { // Every JPEG block must begin with a 0xFF if (input[i] !== 0xff) { + // Change from upstream: fix non-0xFF blocks skipping input = input.slice(i) continue }