Skip to content

Assets corrupted on export #2873

@Guyda

Description

@Guyda

All the downloaded image and video files from the export are corrupted. I've tried this on two different spaces with the same issue.

Expected Behavior

Content and assets exported from Contentful to my local machine.

Actual Behavior

Assets turn out to be corrupted on cli export

Steps to Reproduce

Running my command

contentful space export 
    --space-id <space_id>
    --management-token <cma_token> 
    --environment-id master 
    --export-dir contentful_exports/test 
    --save-file 
    --max-allowed-limit 1000 
    --download-assets

Returns this

 ✔ Initialize client (1s)
  ✔ Fetching data from space
    ✔ Connecting to space (1s)
    ✔ Fetching content types data (1s)
    ✔ Fetching tags data (1s)
    ✔ Fetching editor interfaces data (4s)
    ✔ Fetching content entries data (1s)
    ✔ Fetching assets data (1s)
    ✔ Fetching locales data (1s)
    ✔ Fetching webhooks data (1s)
    ✔ Fetching roles data (1s)
  ✔ Download assets (34s)
  ✔ Write export log file
    ✔ Lookup directory to store the logs
    ✔ Create log directory
    ✔ Writing data to file
┌──────────────────────────┐
│ Exported entities        │
├───────────────────┬──────┤
│ Content Types     │ 25   │
├───────────────────┼──────┤
│ Tags              │ 47   │
├───────────────────┼──────┤
│ Editor Interfaces │ 25   │
├───────────────────┼──────┤
│ Entries           │ 1204 │
├───────────────────┼──────┤
│ Assets            │ 378  │
├───────────────────┼──────┤
│ Locales           │ 1    │
├───────────────────┼──────┤
│ Webhooks          │ 3    │
├───────────────────┼──────┤
│ Roles             │ 3    │
└───────────────────┴──────┘
┌─────────────────────────────┐
│ Asset file download results │
├──────────────────┬──────────┤
│ Successful       │ 378      │
├──────────────────┼──────────┤
│ Warnings         │ 0        │
├──────────────────┼──────────┤
│ Errors           │ 0        │
└──────────────────┴──────────┘
The export took 1 minute (42s)

Opening any files from the export with the preview app in OSX:
Screenshot 2024-12-13 at 12 42 21 PM

Tested with ImageMagick

magick 96.jpg -strip fixed-96.jpg
magick: Not a JPEG file: starts with 0xef 0xbf `96.jpg' @ error/jpeg.c/JPEGErrorHandler/356.

One thing I noticed in the export is when it's downloading the assets it says unknown in the terminal see sample here. Is it not detecting the file format?

downloaded unknown (//images.ctfassets.net/<space_id>/<uid>/96.jpg etc...

Environment

Node: 20.17.0
Npm: 10.9.0
Contentful: 3.7.1
Operating System: OSX 15.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions