[wp-trac] [WordPress Trac] #32059: Media views EmbedLink should check for empty url string

WordPress Trac noreply at wordpress.org
Wed Apr 22 14:41:10 UTC 2015


#32059: Media views EmbedLink should check for empty url string
--------------------------+------------------------------
 Reporter:  afercia       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  4.1
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  ui, javascript
--------------------------+------------------------------
Description changed by afercia:

Old description:

> Splitting this out from #29476. Noticed one small thing: embedding a URL
> in the "Insert from URL" field should handle also the case when users
> empty the field. To reproduce;
>
> Edit/create a post then go in Add Media > Insert from URL
>
> - paste an embeddable URL
> - then empty the field
> - at this point `url` is an empty string
> - the AJAX call fires
> - the "Link Text" field appears
>
> You will also see a PHP notice in your console:
> {{{
> <b>Notice</b>:  Undefined variable: url in <b>.../ajax-actions.php</b> on
> line <b>2749
> }}}
>
> looks like this check in
> [https://core.trac.wordpress.org/browser/trunk/src/wp-
> includes/js/media/views/embed/link.js?rev=32258#L33 this line in /wp-
> includes/js/media/views/embed/link.js]
> {{{
> if ( url && url.length < 6 ) {
>   ...
> }}}
>
> should also check when `url` is falsey.
>
> Also, not sure why 6 characters :) http:// is made by 7 characters but
> maybe I'm missing something.

New description:

 Splitting this out from #29476. Noticed one small thing: embedding a URL
 in the "Insert from URL" field should handle also the case when users
 empty the field. To reproduce;

 Edit/create a post then go in Add Media > Insert from URL

 - paste an embeddable URL
 - then empty the field
 - at this point `url` is an empty string
 - the AJAX call fires
 - the "Link Text" field appears

 You will also see a PHP notice in your console:
 {{{
 <b>Notice</b>:  Undefined variable: url in <b>.../ajax-actions.php</b> on
 line <b>2749
 }}}

 looks like this check in
 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/js/media/views/embed/link.js?rev=32258#L33 this line in /wp-
 includes/js/media/views/embed/link.js]
 {{{
 if ( url && url.length < 6 ) {
   ...
 }}}

 should also check when `url` is falsey.

 Also, not sure why 6 characters :) `http://` is made by 7 characters but
 maybe I'm missing something.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32059#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list