#Uploading with tempFilePath chokes at CMYK JPEG

3 messages · Page 1 of 1 (latest)

trail falcon
#

Hello! I am trying to migrate some data from another location to Payload, including some images.
I fetch the images and cache them to the filesystem, since I want to test the migration multiple times.

I'm trying to use the filePath parameter in payload.create but it is throwing an error for CMYK JPEG images.
According to ChatGPT, the library used to determine the size of the JPEG (image-size) does not actually handle non-SRGB well.

What's the best way to solve this?

slender galleonBOT
trail falcon
#

The error I get is as follows:

ERROR: Corrupt JPG, exceeded buffer limits
    err: {
      "type": "TypeError",
      "message": "Corrupt JPG, exceeded buffer limits",
      "stack":
          TypeError: Corrupt JPG, exceeded buffer limits
              at validateInput (file:///[project]/node_modules/.pnpm/image-size@2.0.2/node_modules/image-size/dist/fromFile.mjs?tsx-namespace=1777478453905:363:11)
              at Object.calculate (file:///[project]/node_modules/.pnpm/image-size@2.0.2/node_modules/image-size/dist/fromFile.mjs?tsx-namespace=1777478453905:374:7)
              at imageSize (file:///[project]/node_modules/.pnpm/image-size@2.0.2/node_modules/image-size/dist/fromFile.mjs?tsx-namespace=1777478453905:977:41)
              at file:///[project]/node_modules/.pnpm/image-size@2.0.2/node_modules/image-size/dist/fromFile.mjs?tsx-namespace=1777478453905:1017:16
              at async Promise.allSettled (index 0)
              at async processQueue (file:///[project]/node_modules/.pnpm/image-size@2.0.2/node_modules/image-size/dist/fromFile.mjs?tsx-namespace=1777478453905:1024:3)
    }