In my assets collection, I have two records with unique ID’s.
Both assets point to the same “real” media file (URL). Both of these assets claim to be pointing to my record.
I would expect that two assets should not point to the exact same media file (URL).
I would expect that when one record has exactly one asset, only exactly one asset should have a link to that item.
Context on my system:
I am guessing that this has occurred during a file replacement.
I replace assets by:
Creating an asset using the uploadLocalFileAndReturnPath function.
I thought that assets were deleted within 24hrs (link).
As in the preceding image, these assets were last updated 1 week ago.
What I need help with
Understanding how to fix this duplication issue.
Understanding how to prevent this from happening in the future/understanding whether I am replacing assets correctly.
Hmm, this is a strange one In my tests, replacing an existing asset with a new file doesn’t result in the creation of a new duplicate, whether in the UI (which warns you about duplicates) or in the API (which doesn’t automatically detect duplicates, but there’s a parameter which can).
// associate a new file with the existing upload object:
await client.uploads.update(uploadId, {
path: await uploadLocalFileAndReturnPath(client, "./image.jpg", {
// if you want, you can specify a different base name for the uploaded file
filename: "different-image-name.png",
}),
});
Your workflow sounds similar, but apparently something went wrong…? You may have found a bug or edge case? Would you mind sharing your upload script, please, so I can try to replicate it and report it? I’m not sure exactly what you did to get to this state, but it’s not intended behavior for sure… sorry about that
Hopefully with a bit more code, I can make it happen and report it for fixing!