Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][Data loss]: if passing an invalid asset.id, fullpath to object mutation GraphQL query, the assets are silently discarded #825

Conversation

robertSt7
Copy link
Contributor

resolves #823

@robertSt7 robertSt7 added the Bug label Dec 14, 2023
@robertSt7 robertSt7 added this to the 1.6.6 milestone Dec 14, 2023
@kingjia90
Copy link
Contributor

kingjia90 commented Jan 16, 2024

Also extend the change to all the other relational types eg.

if ($element) {
$metaData = $newValueItemValue['metadata'] ?? null;
if ($metaData) {
foreach ($metaData as $metaDataKey => $metaDataValue) {
$columns[] = $metaDataValue['name'];
$data[$metaDataValue['name']] = $metaDataValue['value'];
}
}
$item = new ElementMetadata($fieldName, $columns ?? [], $element);
if (isset($data) === true) {
$item->setData($data);
}
$result[] = $item;
}

if ($element) {
$result[] = $element;
}

or maybe just move the exception to getElementByTypeAndIdOrPath() but may need to change these

$assetElement = $this->getElementByTypeAndIdOrPath($args, 'asset');
if (!$assetElement) {
return null;
}

to try-catch

@kingjia90 kingjia90 merged commit 2d8d815 into 1.6 Feb 21, 2024
@kingjia90 kingjia90 deleted the 823-bugdata-loss-if-passing-an-invalid-assetid-fullpath-to-object-mutation-graphql-query-the-assets-are-silently-discarded branch February 21, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants