Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#53917 closed defect (bug) (fixed)

Default value of WEBP images in the Classic Editor

Reported by: almendron's profile almendron Owned by: adamsilverstein's profile adamsilverstein
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.8
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description

To replicate the problem:

1.- Upload a WEBP image to a post with the Classic Editor. In "Link to" put "None".

2.- Save entry.

3.- Now upload another WEBP image. It is supposed that in "Link to" it should put "None", but it is not like that since "Media file" is kept. For some reason it does not save the value of the previous upload.

Also, the view scrolls down

Note: if you do the same test with a "jpg" image, then it does save the value of the last image uploaded.

Attachments (2)

media.53917.diff (1.3 KB) - added by kallookoo 3 years ago.
Add webp extension to test
53917.diff (646 bytes) - added by adamsilverstein 3 years ago.
refresh patch against trunk

Download all attachments as: .zip

Change History (21)

#1 @desrosj
3 years ago

  • Component changed from Editor to Media

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


3 years ago

#3 @antpb
3 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.8.1

#4 @desrosj
3 years ago

  • Keywords reporter-feedback added
  • Milestone changed from 5.8.1 to Awaiting Review

Hi @almendron,

Thank you for this report, and welcome to Trac!

I've been trying to reproduce this, but it seems to be working as expected for me. I've tried several combinations of saving, inserting/uploading various image formats, and using different link options.

Can you check if you're able to reproduce with a fresh install? Or on the same install with no plugins active? Also, can you check your console for any JavaScript problems?

I'm going to kick this back to Awaiting Review since the 5.8.1 RC is due out in 2 days. If someone is able to reproduce and a patch is created/tested before then, it can be moved back for consideration.

#5 @almendron
3 years ago

1) Tests performed on a plugin-free installation (except with https://wordpress.org/plugins/classic-editor/ )

2) JavaScript problems? No

3) Have you tried the Classic Editor?

#6 @desrosj
3 years ago

  • Keywords needs-testing added; needs-patch removed

My testing process:

  • Fresh install of trunk (WP 5.9 nightly).
  • Classic Editor plugin active only.
  • Twenty Twenty-One theme active.
  • Click add media.
  • Upload WebP image.
  • Select a different Link To value.

I've tried the following both before and after saving:

  • Upload another WebP to the same post and a new post.
  • Upload another image format (JPG) to the same and a new post.

In all instances I'm unable to reproduce. The selected Link To value persists, and I see the value reflected in the user meta settings.

Can you check what the role of the user you are testing with is?

Also to be clear, I'm not trying to say you're not seeing the issue or that it's invalid, just that I am unable to reproduce it with the information available currently. It's possible another contributor can find out what I'm missing. But that has to be determined before a fix can be created.

#7 @almendron
3 years ago

Fresh install of trunk (WP 5.9 nightly) : Are you testing with version 5.9?

I work with version 5.8

#8 @desrosj
3 years ago

trunk is the latest development of WordPress, which is essentially 5.8 with some newer updates that will be included in the next release (5.9).

Just to be sure, I've retested using 5.8 and I am still unable to reproduce.

When you see the behavior, are you editing posts? Pages? A custom post type? Does it happen for all of them?

#9 @almendron
3 years ago

Post draft


1) Upload webp image. Change "Link to" -> "none"
2) Insert image and save draft
3) Upload webp image. "Link to" automatically changes to "Media file"

This does not happen with "alignment" and "size". They keep the values of the last uploaded image.


1) Upload jpg image. Change "Link to" -> "none"
2) Insert image and save draft
3) Upload jpg image. "Link to" it does not change. Is "none"

#10 @almendron
3 years ago

When you see the behavior,

are you editing posts? Pages? posts and pages

A custom post type? NO

Does it happen for all of them? Yes

#11 @kallookoo
3 years ago

Hi,
After checking it, the problem is in the isImageAttachment function that checks if it is an image and the webp extension is not defined.


@kallookoo
3 years ago

Add webp extension to test

#12 @almendron
3 years ago

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

#13 @almendron
3 years ago

Hi @desrosj @antpb

I have spoken with several colleagues from "WordPress Spain" and they can all reproduce the problem.

@kallookoo , for example, has observed the problem and found the reason that one of the fields (Link to) is invariable. In less than 5 minutes, he has found the solution.

Can you change the value of "Milestone" so that the solution will be added in the next revision?

#14 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 5.9

Related: #54146

#15 @adamsilverstein
3 years ago

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

#17 @adamsilverstein
3 years ago

  • Keywords commit added

@almendron thanks for follow up here and the additional clarification of steps to reproduce. I was able to reproduce the issue as you described (the last link to type was not being used for webp images - after the patch is is). This seems worth fixing since you confirmed it is affecting users.

@kallookoo - thanks for confirming the issue on your end as well and for the patch, that looks good.

Last edited 3 years ago by adamsilverstein (previous) (diff)

@adamsilverstein
3 years ago

refresh patch against trunk

#18 @adamsilverstein
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 52073:

Media: Add "webp" extension to wp.media.controller.Library isImageAttachment.

Add "webp" extension to a media extension check, fixing an issue where the last used media
link type was not used for WebP images.

Props almendron, desrosj, kallookoo.
Fixes #53917.

Note: See TracTickets for help on using tickets.