Managing Media File Visibility in Drupal Using ECA

Maksym Kaharlytskyi on Unsplash

Kai Gertz highlights a key flaw in Drupal’s media system: files remain publicly accessible even after their media entities are unpublished or deleted. This disconnect can expose sensitive content via direct URLs, contrary to user expectations. The Tojio blog evaluates conventional fixes, including the Media File Delete module and File Visibility module. While functional, these solutions introduce either UX friction or server performance risks—especially when defaulting to Drupal’s private file system.

In the blog post, “Drupal: Media, files and how to control their visibility,” Kai Gertz proposes a cleaner alternative using the ECA (Event, Condition, Action) module. His approach temporarily renames files with a .ht prefix when media is unpublished, breaking public access. The name is restored upon re-publication. This method aligns visibility with editorial intent without straining performance. The post includes a downloadable ECA model, giving site builders a practical tool for nuanced file access control. This is a thoughtful, low-overhead solution to a persistent problem in Drupal file handling.

Source Reference

Date of Publication

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Related People

Upcoming Events

Latest Opportunities