[wp-trac] [WordPress Trac] #19918: Attachments are viewable from any permalink that matches their slug

WordPress Trac noreply at wordpress.org
Fri Dec 4 17:03:38 UTC 2015


#19918: Attachments are viewable from any permalink that matches their slug
--------------------------+-----------------------------
 Reporter:  prorock       |       Owner:  wonderboymusic
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  4.4
Component:  Permalinks    |     Version:  3.2
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------
Changes (by tellyworth):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [comment:17 tellyworth]:
 > These two recent commits triggered a circular redirect in some themes on
 wp.com. Those themes filter `attachment_link` to add a fragment `#main`,
 and that interacts with the new code to redirect back to the same url.

 I'm reasonably convinced that this is a general problem in
 `redirect_canonical()`. If any of the functions used to generate a
 canonical URL (such as `get_permalink()`) are filtered to add a #fragment,
 this causes the circular redirect detection logic to fail.

 attachment:19918-circular-fragment.diff prevents this from happening. It
 fixes the attachment issue, and shouldn't prevent redirecting to a URL
 that contains a fragment, which is probably a valid use case.

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


More information about the wp-trac mailing list