Drupal should prevent uploading of duplicates for managed files

Created on 2 March 2015, over 10 years ago
Updated 2 May 2025, 3 months ago

Since we can monitor managed files in Drupal core we should prevent uploading of existing content by comparing hash of the uploaded file with existing files. This would not be a hard task but it would be applicable only to file upload widgets and not for managed inline images/files that CKEDITOR now supports so another value for the file would be required, something like "duplicate" or something like that so new files' hashes are compared only with the original file and not its duplicate(s).

The uplaoded file, if it would match the existing one, would get deleted right away and the id of the original file with the matching hash would be returned as value for the file upload widget, maybe with a message so the user knows why the file might be named differently and/or with option to upload the duplicate anyway, and usage wold be added for the original file.

Potentially, this could reveal if some files already exist in the file system so there is a small risk regarding informaiton/privacy leaking but it can be taken care of with proper permissions.

For example a privileged user would see a notification after the file get's uploaded that it already exists and if he want's to create a duplicate(only in DB) with the file name of the uploaded file or if using file name of the original, already uploaded, file is ok. Unprivileged user would not see any changes and based on settings the new file would either create a new duplicate entry or it would silently use the original file's name.

In any case only one file with the same hash would be physically present on the server with the possibility to have multiple entries in database pointing to the original one acting as "diplicate" entries.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

file system

Created by

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024