Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Statistics Counter Module statistics_counter crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

Media Dedupe

No security coverage
View on drupal.org

This module prevents duplicate media entities from being created by checking file content hashes. When a user uploads a file identical to one already stored, the system automatically references the existing media entity instead of creating a new one. This works regardless of file names and covers both the Media Library widget and standalone media add forms.

Media Dedupe

Media Dedupe keeps your media library clean by preventing duplicate media entities from ever being created. When an
editor uploads a file whose contents are byte-for-byte identical to one already stored, Media Dedupe transparently
references the existing media entity instead of creating a new duplicate - no error message, no manual decision, no
clutter.

Detection is content-based (a cryptographic hash of the file), so it works regardless of the file name, and it covers
both the Media Library widget and the standalone /media/add/* forms.

Key features

- Content-hash matching (SHA-256 via File Hash https://www.drupal.org/project/filehash) - not filename-based, so
renamed-but-identical files are still caught and different files that happen to share a name are not falsely flagged.
- Transparent auto-reference - the existing media item is reused automatically; the editor is simply pointed at it. No
"file already exists" dead-end.
- Covers both upload paths - the Media Library upload dialog and the standalone media add form (/media/add/{type}).
- Per-media-type control - enable deduplication globally or restrict it to specific file-based media types.
- Drupal 10 & 11, clean dependency-injected code, passes phpcs (Drupal/DrupalPractice) and PHPStan, and ships with a
Kernel test.

How it works

File hashes are computed and stored by the File Hash module. On upload, Media Dedupe looks up the uploaded file's hash
among existing permanent files. If a match is found, the Media Library and media-add forms are overridden so that the
existing media entity is referenced (or the user is redirected to it) instead of a new duplicate being persisted. If
no match is found, the file is stored normally.

Backfill hashes for pre-existing files once with drush filehash:generate.

Requirements

- Drupal ^10 || ^11
- File Hash (https://www.drupal.org/project/filehash) with at least one algorithm enabled (SHA-256 recommended)
- Core Media Library

Configuration

Settings live at Administration → Configuration → Media → Media Dedupe (/admin/config/media/media-dedupe): a master
on/off switch and an optional restriction to specific media types.

How this differs from similar modules

Several modules address media duplicates, but with a different strategy:

- Media Duplicate Check and similar detect by filename and warn the editor.
- Media Dupe Detect hashes files but only suggests the existing item.

Media Dedupe is the only one that combines byte-exact content hashing with automatic referencing of the existing
entity across both upload paths - the duplicate simply never gets created.

Limitations

- Matching is byte-exact: visually similar but re-encoded/resized images are treated as different files.
- Deduplication is scoped per media type.
- Only local, file-based sources are supported (remote/oEmbed sources such as YouTube are out of scope).

Activity

Tracked releases
1
Tracked since
Aug 2026
Latest release
1 week ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0-alpha1 Pre-release Aug 11, 2026