Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#22740 closed defect (bug) (fixed)

3.5 Media: "From URL" doesn't provide any feedback on error

Reported by: viper007bond's profile Viper007Bond Owned by: koopersmith's profile koopersmith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: Cc:

Description (last modified by Viper007Bond)

If you paste an image URL into the "From URL" field and your browser fails to load the image, say due to network issues or the image being 404, then you are given no indication as to why the extra fields that would normally show up aren't showing up. This can confuse users.

A simple error message stating the image was not an image or that the image failed to load (misspelling for example) would assist the user in debugging and resolving the issue.

Attachments (2)

22740.diff (731 bytes) - added by koopersmith 14 years ago.
22740.2.diff (2.2 KB) - added by koopersmith 14 years ago.

Download all attachments as: .zip

Change History (19)

#1 @Viper007Bond
14 years ago

  • Description modified (diff)

#2 @nacin
14 years ago

Good point.

I am trying to think of the easiest way to fix this. If it's not a 200, we can show "File not found." Otherwise, it isn't an image, we can maybe reveal the discovered mime type (or do nothing).

The way we detect images is with new Image in JS. I am assuming that won't allow us to do an HTTP status code check.

We can resort to the older, less intelligent UI, which asked "Image" versus "Audio, Video, or Other File" to avoid this kind of ambiguity from being clever but not clever enough.

#3 @nacin
14 years ago

  • Type changed from enhancement to defect (bug)

@koopersmith
14 years ago

#4 @koopersmith
14 years ago

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

#5 follow-up: @johnbillion
14 years ago

3.4 shows a red X next to the URL input field if it doesn't get a 200 when it tries to fetch the image.

#6 in reply to: ↑ 5 ; follow-up: @Viper007Bond
14 years ago

Replying to johnbillion:

3.4 shows a red X next to the URL input field if it doesn't get a 200 when it tries to fetch the image.

Bonus: no new strings.

#7 in reply to: ↑ 6 @nacin
14 years ago

Replying to Viper007Bond:

Replying to johnbillion:

3.4 shows a red X next to the URL input field if it doesn't get a 200 when it tries to fetch the image.

Bonus: no new strings.

Right, but we're using that same check to determine if it is an Image. We have no good way of determining if it is not an image (but is, and is failing), or if it is not an image (and really isn't an image).

Can you please test 22740.diff? What it does is automatically assume that .jpg, .png, and .gif are images, so the fields may be shown, even if it can't load it.

If we wanted to top this off, we can probably also add back a red X if it thinks it is an image based on the extension (which will show the fields) but fetching it doesn't work (which will tell the user something is wrong).

#8 @Viper007Bond
14 years ago

This patch should certainly help with most cases. There's still a few edge cases but those are extra edgy because it also has to additionally fail to load.

Looks good to me.

#9 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.5

I think 22740.diff is likely sufficient for 3.5.

#10 @ryan
14 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In 23048:

When inserting an image From URL, show the fields only if it looks like we have a valid image.

Props koopersmith
fixes #22740

#11 follow-up: @ryan
14 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

A couple of times I've seen the insert button remain inactive even though the image and the details show.

#12 @ryan
14 years ago

  • Keywords has-patch commit removed

#13 in reply to: ↑ 11 @koopersmith
14 years ago

Replying to ryan:

A couple of times I've seen the insert button remain inactive even though the image and the details show.

Did you happen to record the URL in those cases?

#14 @ryan
14 years ago

http://trunk/wp-content/uploads/2012/12/avast12.jpg

Most of the time it works. Sometimes not. Haven't been able conjure reliable steps to reproduce.

#15 @ryan
14 years ago

https links not working but could be my sandbox SSL setup.

Insert a link. Modal closes. Click Add Media to pop the modal back up. From URL still shows the image that was just inserted. Maybe this should lose its memory after a successful insertion.

#16 @nacin
14 years ago

  • Owner changed from ryan to koopersmith
  • Status changed from reopened to assigned

Two issues:

  • The button disabling check should simply be prop('disabled', 'http://' === text). It is designed to prevent insertion when the placeholder is there.
  • The view should lose its memory.

Koopersmith working on both.

@koopersmith
14 years ago

#17 @ryan
14 years ago

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

In 23065:

Clear the From URL view in the media modal after inserting an image. Improve button enable checks.

Props koopersmith
fixes #22740

Note: See TracTickets for help on using tickets.