apostrophecms / apostrophecms/apostrophe

Corrupted image breaks entire image menu

Open
#4,713 8 comments 0 reactions 0 assignees View on GitHub
contributions welcome
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## To Reproduce

Unsure at the moment. Images have gotten corrupted at seemingly random times, it's unclear whether this is a bug with Apostrophe or something on our end. Mind you, this has nothing to do with the image file being missing or corrupted, it seems like the image is missing any reference to image files at all.

## Expected behavior

When an image is corrupted, don't load it, or show that the image is broken.

## Describe the bug

The corrupted image fails to load, causing all other images and the "Drop new media here" box not to appear.
The images do exist however. Clicking the checkbox in the top left reveals all images on the right side of the menu, including the broken image. Archiving this image will fix the bug for the live images, but will in turn break the archive.

In the browser console I recall seeing something along the lines of `Cannot read properties of null (reading '_urls')`.

## Details

**Server Operating System:** A Docker image based on `node:lts-alpine3.15`. The MongoDB database runs in a separate container.
This has only occured in production so far.

**Screenshot:**
This is a recreation of what the image menu would look like with a corrupted image.
![image](https://github.com/user-attachments/assets/69b6b1c5-4373-4ee2-90f9-fbe8ff3da4db)

Contributor guide

Open the contributing guide

Research direction

No source file or test is identified in the issue. Start with the image menu and the browser-console error about reading `_urls` from null, then inspect how corrupted image records are loaded and determine how the menu should render when one record lacks image-file references; done means the remaining images and upload box still appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, javascript, mongodb, node.js
Domain
backend, databases, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.