Skip to content

Gutenberg: Uploads Files to Wrong Folder #56901

Open

Description

Quick summary

I'm not sure if this was reported already, but I wasn't able to find anything and I'm not really sure how to search further.

Gutenberg is uploading media files to a folder with the exact date you're uploading, not to the date from the content you're editing.

Steps to reproduce

  1. Go to a site where you have older posts.
  2. Edit an old post and upload a new image as the featured image.
  3. Add an Image block and upload a new image to it.
  4. Check both images URL, from the featured image, and the one from the Image block.

What you expected to happen

Both images should have the same URL, with the post's year.

What actually happened

The featured image's URL will have the post's year, but the image uploaded through Gutenberg won't.

I've tested with the Image and Gallery blocks, and with other file types, such as the File block uploading a PDF file, the same thing happens. Tested on both WordPress.com and WordPress.org.

Context

I first realized this issue when helping a user with something else, I tried to find an image from 2019 (with 2019 on its URL) on WP-Admin's media library, and when using the 2019 filter the image didn't show up (which might be another issue, not sure if this is actually expected - the WP-Admin media library's filter is for uploaded date, not the folder/URL). Then I noticed that an image uploaded in 2021, had the URL from a different year, which was the year from the post it was uploaded to.

Here are the steps I followed on my tests:

  1. Edited a post from 2019
  2. Uploaded a featured image: image's URL has 2019 on it, the post's year
  3. Uploaded an image using the Image or Gallery block: image's URL has 2021 on it, today's year

Then to compare with how it used to work, I tried using the Classic Editor and the Classic block:

  1. Edited a post from 2019
  2. Uploaded a featured image: image's URL has 2019 on it, the post's year
  3. Added a Classic block, and uploaded an image through it: image's URL has 2019 on it, the post's year
  4. The same thing happens when using the Classic Editor: image's URL has 2019 on it, the post's year

So it seems that Gutenberg isn't uploading the images to the right folder, it's uploading to the current date, instead of the content's creation date, which is how it used to be.

Not sure if this is intentional, but my guess is that users would expect this behavior to not change. If you have a page or post from 2019, you'd expect that all its files would be on the 2019 upload folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions