Skip to content

fix(CopyContent): Moved Multitree validation before copyContentlet call + added DEFAULT variantId logic in PageResourceHelper#34696

Merged
nollymar merged 1 commit intomainfrom
issue-34473
Feb 20, 2026
Merged

fix(CopyContent): Moved Multitree validation before copyContentlet call + added DEFAULT variantId logic in PageResourceHelper#34696
nollymar merged 1 commit intomainfrom
issue-34473

Conversation

@ihoffmann-dot
Copy link
Contributor

Summary

Moved Multitree validation before copyContentlet call + added DEFAULT variantId logic in PageResourceHelper in case of null/empty values.

Changes

  • Changed the validation order in PageResourceHelper.copyContentlet() method. Now we validate the existence of the Multitree before actually copying the Contentlet.
  • Added a default value for variantId in case the value from the request is null or empty.
  • Added integration tests.

Motivation

The issue related to this PR shows that we return a 404 when attempting to copy a contentlet and the variantId in the request is empty. To address this, we added logic to set a default value when the variantId is null or empty.

Additionally, while investigating this issue, we uncovered another problem. The contentlet was being copied before doing the required validations for the Multitree. So when the Multitree call returned null, the response was still a 404, but the contentlet had already been copied, and the rollback was not being done.

This means the bug was not limited to the empty variantId scenario. Any case where the Multitree was null could trigger the same unintended behavior.

Related Issue

Fixes: BUG: PUT /api/v1/page/copyContent returns 404 but successfully copies content when variantId is empty string #34473

…+ added DEFAULT variantId logic in PageResourceHelper in case of null/empty values
@nollymar nollymar enabled auto-merge February 20, 2026 17:56
@nollymar nollymar added this pull request to the merge queue Feb 20, 2026
Merged via the queue into main with commit 43ddcc4 Feb 20, 2026
40 checks passed
@nollymar nollymar deleted the issue-34473 branch February 20, 2026 19:25
oidacra pushed a commit that referenced this pull request Feb 20, 2026
…ll + added DEFAULT variantId logic in PageResourceHelper (#34696)

## Summary

Moved Multitree validation before copyContentlet call + added DEFAULT
variantId logic in PageResourceHelper in case of null/empty values.

## Changes

- Changed the validation order in PageResourceHelper.copyContentlet()
method. Now we validate the existence of the Multitree before actually
copying the Contentlet.
- Added a default value for variantId in case the value from the request
is null or empty.
- Added integration tests.

## Motivation

The issue related to this PR shows that we return a 404 when attempting
to copy a contentlet and the variantId in the request is empty. To
address this, we added logic to set a default value when the variantId
is null or empty.

Additionally, while investigating this issue, we uncovered another
problem. The contentlet was being copied before doing the required
validations for the Multitree. So when the Multitree call returned null,
the response was still a 404, but the contentlet had already been
copied, and the rollback was not being done.

This means the bug was not limited to the empty variantId scenario. Any
case where the Multitree was null could trigger the same unintended
behavior.

## Related Issue
Fixes: [BUG: PUT /api/v1/page/copyContent returns 404 but successfully
copies content when variantId is empty string
#34473](#34473)
dsolistorres pushed a commit that referenced this pull request Feb 20, 2026
…ll + added DEFAULT variantId logic in PageResourceHelper (#34696)

## Summary

Moved Multitree validation before copyContentlet call + added DEFAULT
variantId logic in PageResourceHelper in case of null/empty values.

## Changes

- Changed the validation order in PageResourceHelper.copyContentlet()
method. Now we validate the existence of the Multitree before actually
copying the Contentlet.
- Added a default value for variantId in case the value from the request
is null or empty.
- Added integration tests.

## Motivation

The issue related to this PR shows that we return a 404 when attempting
to copy a contentlet and the variantId in the request is empty. To
address this, we added logic to set a default value when the variantId
is null or empty.

Additionally, while investigating this issue, we uncovered another
problem. The contentlet was being copied before doing the required
validations for the Multitree. So when the Multitree call returned null,
the response was still a 404, but the contentlet had already been
copied, and the rollback was not being done.

This means the bug was not limited to the empty variantId scenario. Any
case where the Multitree was null could trigger the same unintended
behavior.

## Related Issue
Fixes: [BUG: PUT /api/v1/page/copyContent returns 404 but successfully
copies content when variantId is empty string
#34473](#34473)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

BUG: PUT /api/v1/page/copyContent returns 404 but successfully copies content when variantId is empty string

4 participants