Prevent creation of duplicate file entities if media is duplicate

Created on 26 March 2024, 3 months ago

Problem/Motivation

I was testing this module and it works fine with media items and prevents the user from creating a duplicate media. But what it doesn't at the moment seem to prevent is that the file system will still generate those files.

The first media item generated seems to be a Permanent type because it's used in the media item but the second one generated is Temporary. But at least our setup doesn't usually clean out temporary files from the file list.

Steps to reproduce

1. Enable the module.
2. Upload two media items with the same image file.
3. Browse to admin/content/files.
4. There should be two file items in the list with identical size but the first one uploaded is permanent and second one is temporary. See the attached screenshot.

Proposed resolution

I think the optimal solution would be that if the media item is deemed duplicate, it wouldn't create a file system item either because those files are still stored in the server and can be accessed with direct URL.

If this might be sometimes the expected behavior, it could be an optional setting in admin/config/media/media-duplicates to also prevent duplicate file items to be generated.

Remaining tasks

TBD.

User interface changes

None or optional new setting in the module settings.

API changes

TBD.

Data model changes

Perhaps a schema change for the new optional setting.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇫🇮Finland HeikkiY Oulu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024