Skip to content

CMS, API: Image not duplicated when duplicating an expired post #1963

Description

@MrDirkelz

Reported by Ivan Slabbert on production.

Symptom: duplicating a post does not copy the image across. The reporter's observation is that this happens when the post being duplicated is expired, though they are not certain that is the actual trigger.

Needed first: confirm the trigger — is it expiry, or something the expired posts happen to share (no image bucket, an older image schema, files already cleaned up in S3)?

Pointers

  • cms/src/components/content/util/buildContentDuplicate.ts — the copy is only requested when the source has an image bucket:

    if (options.duplicateImage && imageData.fileCollections?.length > 0) {
        if (parent.imageBucketId) imageData.duplicate = true;
        else imageData.fileCollections = [];
    }

    So a source with no imageBucketId, or with empty fileCollections, silently produces a duplicate with no image and no error shown to the user.

  • api/src/changeRequests/documentProcessing/processImageDto.ts:204 — server side of the copy. It pushes warnings such as "Parent bucket ID is required for duplicated image copy." and clears fileCollections when the copy fails. Checking whether those warnings appear for the failing duplications should tell us which side is dropping the image.

Whatever the trigger turns out to be, a failed image copy should surface to the user in the CMS rather than quietly producing an image-less duplicate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions