[wp-trac] [WordPress Trac] #36822: srcset is added to <img /> even if media file is not present in media library

WordPress Trac noreply at wordpress.org
Sat May 21 15:15:58 UTC 2016


#36822: srcset is added to <img /> even if media file is not present in media
library
-------------------------------------------------+-------------------------
 Reporter:  temmokan                             |       Owner:  joemcgill
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  4.6
Component:  Media                                |     Version:  4.4.1
 Severity:  normal                               |  Resolution:
 Keywords:  responsive has-patch needs-unit-     |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by joemcgill):

 * keywords:  responsive => responsive has-patch needs-unit-tests


Comment:

 [attachment:36822.diff] tests whether the full file path of the `src`
 attribute matches the path of the sources that would be returned in a
 `srcset`, which will prevent false positives when the `src` has been
 manually moved outside the uploads directory, but will retain the ability
 for the hostname to have been changed (e.g. CDN offloads).

 @temmokan this should fix your first example, but your second example
 would still return a `srcset` so we don't break responsive images for
 people who have offloaded their images to a CDN while retaining the file
 structure.

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


More information about the wp-trac mailing list