Make WordPress Core

Opened 5 years ago

Last modified 3 months ago

#39108 assigned defect (bug)

Media: can't leave an image "untitled" from the "Edit Media" menu

Reported by: dromero20 Owned by: junaidkbr
Milestone: 5.9 Priority: normal
Severity: normal Version: 4.6.1
Component: Media Keywords: good-first-bug has-patch needs-testing has-testing-info
Focuses: Cc:


Just found this issue while testing the Media Library. If you try to remove the image's title from the "Edit Media", it gets "autorenamed" with the original name of the uploaded file. You can't leave that image untitled. But, if you rename the image from the "Attachment Details" menu, you can leave the image untitled perfectly.

I've made a gif of the process, I hope it helps to understand what I'm saying:

Steps to reproduce
-Upload an image.
-Go to Media Library (wp-admin)
-Select Mode:List View and click on the image
-Change the name, Update. Then, remove the name, Update again (the image will be renamed with the file's original name)

Attachments (3)

media.gif (4.9 MB) - added by dromero20 5 years ago.
Gif of the issue
Jan-05-2018 08-41-38.mp4 (6.9 MB) - added by desrosj 4 years ago.
Updated demo of the bug
39108.patch (1.2 KB) - added by Junaidkbr 4 years ago.

Change History (16)

5 years ago

Gif of the issue

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.

4 years ago

#2 @desrosj
4 years ago

  • Keywords needs-patch good-first-bug added

Hi @dromero20, and welcome to Trac!

I was able to reproduce this bug. Are you interested in creating a patch for this? For help with that, you can check out the handbook: https://make.wordpress.org/core/handbook/contribute/

4 years ago

Updated demo of the bug

4 years ago

#3 @Junaidkbr
4 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

@desrosj My patch takes care of the issue but I had trouble sending the auto generated title back to the media modal.

My patch has changes in https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/ajax-actions.php#L2516 where I am returning wp_send_json_success( $json_data ); with $json_data = array( 'title' => $new_title );. But I have no clue how to get it from the AJAX response at https://core.trac.wordpress.org/browser/tags/4.9/src/wp-includes/js/media-views.js?rev=42198#L6331

#4 @DrewAPicture
4 years ago

  • Owner set to junaidkbr
  • Status changed from new to assigned

Assigning to mark the good-first-bug as "claimed".

This ticket was mentioned in Slack in #core by sergey. View the logs.

8 months ago

#6 @SergeyBiryukov
8 months ago

  • Milestone changed from Awaiting Review to 5.8

#7 @Boniu91
7 months ago

  • Keywords has-testing-info added

This ticket was mentioned in Slack in #core-test by boniu91. View the logs.

6 months ago

#9 @francina
6 months ago

Is the expected behavior to get the file to be Untitled in both cases or to be renamed in both cases?

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

5 months ago

#11 @antpb
5 months ago

It was discussed in the recent Media meeting that we should maybe mimic the behavior of a no-title post. (no title) when no title is set.

This should fit in nicely with the proposed patch but instead using the string posts use for no-titles.

#12 @audrasjb
5 months ago

  • Milestone changed from 5.8 to 5.9

It looks like this ticket still needs some work.
Given we're about to release 5.8 beta 1, let's move it for 5.9 consideration.

#13 @aadilali
3 months ago

WordPress set image name as the default post title if it is empty or post blank. Following function written in "wp-admin\includes\media.php" handle this scenario.

"function image_attachment_fields_to_save()"

You can remove this function to get the (no title) by default.

Note: See TracTickets for help on using tickets.