Image URLs Remain Accessible After Deleting Associated Articles in Drupal 9

By toswebdev, 22 September, 2023
Image URLs Remain Accessible After Deleting Associated Articles in Drupal 9

Description:

I've encountered an issue in Drupal 9 related to the handling of image URLs when articles are deleted. Here's a breakdown of the problem:

Description:

I created articles using the article content type, each with titles, bodies, and associated images. The issue arises when I copy the URL for an image embedded within an article. After deleting the article, the image URL remains accessible, which is not the expected behavior. Ideally, when an article containing an image is deleted, not only should the image itself be removed, but its URL should also become inaccessible.

Steps to Reproduce:

1. Create an article using the article content type in Drupal 9.
2. Embed an image within the article and note its URL.
3. Delete the article.
4. Attempt to access the image URL that was copied in step 2.

Expected Result:

After step 3, both the article and its associated image should be deleted and the image URL should no longer be accessible.

Actual Result:

The image URL remains accessible even after the article is deleted.

Additional Information:

This issue raises concerns about data security and user access control, as deleted content and associated assets should not be accessible via direct URLs. I'm looking for guidance on how to ensure that deleted content and its associated assets are properly removed from the server and inaccessible via their URLs.

Here the Solution for Now.

If your client is not satisfied by the explanation for this behaviour given in this change record, you can remedy the situation in two different ways:

  1. Switch to using the private file system (as explained in my first reply).
  2. Set $config['file.settings']['make_unused_managed_files_temporary'] = TRUE; in your settings.php (as explained in the change record). After that set the temporary file delete should set 6hr the.

    https://www.drupal.org/node/2891902

    https://www.drupal.org/forum/general/general-discussion/2023-09-22/image-urls-remain-accessible-after-deleting-associated-articles-in-drupal-9

Please share your ideas in the comments section if you have any ideas for how to resolve this issue 

Comments

All comments go through moderation, so your comment won't display immediately.