I have a content type, Listings, that has an “images” field. It’s a media field, to allow users to upload multiple images associated with a Listing.
I would like to be able to “disconnect” an image file from a Listing, see context for why below. However, it seems like calling “connect”, “disconnect”, or “set” on this field simply removes all the relations. I’ve tried through the REST API and with a custom controller using the entity service. See the bug ticket I opened: Using `disconnect` on one file relation removes all file relations · Issue #20961 · strapi/strapi · GitHub
I know the docs say we can’t add a new file via connect/disconnect, but my goal isn’t to upload a new file this way but to remove the relation.
Is it possible to programmatically remove relations from the Upload plugin without actually deleting the file?
Context:
Motivation for “disconnecting” over deleting images is that I require ownership protection of Listings in my application. If I can somehow allow users to delete images from their Listings by making edits to a Listing, then ownership protection over images becomes much easier. I’d like to avoid exposing the Upload API endpoints, and therefore needing to extend ownership to those endpoints, if at all possible. I figure I can clean up the disconnected images with a cron job or something.
This topic has been created from a Discord post (1273266065673293886) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord