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

Losing metadata when updating with invalid data #612

Closed
christeredvartsen opened this issue Sep 19, 2019 · 0 comments
Closed

Losing metadata when updating with invalid data #612

christeredvartsen opened this issue Sep 19, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@christeredvartsen
Copy link
Member

In the Imbo\Database\Doctrine database adapter it is possible to lose existing metadata attached to an image if the new metadata has an invalid key when updating. This is because the adapter deletes existing metadata before normalizing the incoming metadata:

// Delete existing metadata
$this->deleteMetadata($user, $imageIdentifier);

// Normalize metadata
$normalizedMetadata = $this->normalizeMetadata($metadata);

$this->normalizeMetadata($metadata); can end up throwing an exception if any metadata keys contains the namespace separator, resulting in all metadata attached to the image is deleted. If we swap the order of the lines the issue should be resolved.

@christeredvartsen christeredvartsen added the bug Something isn't working label Sep 19, 2019
@christeredvartsen christeredvartsen self-assigned this Sep 19, 2019
@christeredvartsen christeredvartsen changed the title Losing metadata when updating with new invalid data Losing metadata when updating wit invalid data Sep 21, 2019
@christeredvartsen christeredvartsen changed the title Losing metadata when updating wit invalid data Losing metadata when updating with invalid data Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant