backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

[UX] File management: "Replace file" doesn't really replace the file #6387

Open klonos opened 8 months ago

klonos commented 8 months ago

Description of the bug

When replacing a managed file with a different one with identical filename, the original file is not really replaced.

Steps To Reproduce

To reproduce the behavior:

  1. Prepare a .png file on your local, and name it either card3-organize.png or card2-card.png or card1-layout.png.
  2. Navigate to admin/content/files and depending on the filename you chose in the previous step, click the "Manage" button of the respective file in the "Manage files" list.
  3. In the file manage form, use the "Replace file" field to upload the file from step 1, and save.
  4. Go to the home page of the site, and verify that the file is replaced 👍🏼
  5. Inspect the page, or right-click the newly-uploaded image and open in a new browser tab. Notice how the file was actually renamed to card3-organize_0.png (or card2-card_0.png or card1-layout_0.png) instead of replacing the original file and keeping the same file name 👎🏼
  6. Navigate to admin/content/files and click "Manage" for the file you replaced.
  7. Click the "View" tab at the top. The old image file is shown 👎🏼

Some additional UX confusion:

  1. Navigate to admin/structure/file-types/settings.
  2. Notice the "Keep original file name" setting in the "File replace options" section, and the help text:

    Rename the newly uploaded file to the name of the original file. This action cannot be undone.

Actual behavior

Expected behavior

Additional information

Drupal has similar odd UX (see https://www.drupal.org/project/drupal/issues/2648816 and related issues), which can be addressed by means of modules like these:

klonos commented 8 months ago

...clearing caches and running cron does not fix the problem above. Perhaps it relies on the garbage collection, and the file is removed after 6 hours (I'll check again).

izmeez commented 8 months ago

This may be related to why with hero block with background, removing the background doesn't really remove the file. There is no replace file option. Adding the replacement file is renamed because the original file had not been removed. I thought I created an issue?