advanced-nova-media-library
advanced-nova-media-library copied to clipboard
Images are duplicated when the Resource is updated
https://user-images.githubusercontent.com/28089352/123995072-3cb64280-d9ce-11eb-894e-c113df2e2b12.mov
Btw, it also duplicates every Images/Files/Media registered
@edemots were you able to solve this?
I have the same problem. Has anyone found a solution?
There is already a pull request https://github.com/ebess/advanced-nova-media-library/pull/212
This one definitely needs to be fixed. ~~The Media model calls the HandlesExistingMediaTrait::addExistingMedia()
method while processing the request even when the enable-existing-media
option is disabled in the config. All current media will be duplicated as they are posted with the update request.~~
Actually, while writing, I discovered the problem. The primary key of the Media model is an integer by default. When this is changed to a uuid, the in_array() check fails as the posted data is converted to an integer.
https://github.com/ebess/advanced-nova-media-library/blob/60c2932b7dde88359687dbc76f81c9d2e465adc0/src/Fields/HandlesExistingMediaTrait.php#L30
Ah, great! @rubenflush! We use UUIDs so that is probably the reason. Thanks for the fix.