Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#33693 closed defect (bug) (fixed)

Feed links are broken for unattached attachments

Reported by: swissspidy's profile swissspidy Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Feeds Keywords: needs-patch good-first-bug
Focuses: Cc:

Description

As per #33664, a media item that isn't attached to a post has a permalink of the form http://example.org/?attachment_id=123.

When you visit that page, you'll notice that the comments feed links for this attachment posts are wrong, looking something like this: http://example.org/?attachment_id=123/feed/.

This is because get_post_comments_feed_link() just appends /feed/ to the permalink if pretty permalinks are enabled. It should check for this scenario though.

Attachments (1)

33693.diff (1.1 KB) - added by iworks 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @swissspidy
8 years ago

See also #1914. Either we wait for the permalinks to be changed or fix this separately.

#2 @stevenkword
8 years ago

I'm also experiencing a redirect loop when trying to visit the comment feed link for a unattached attachment when pretty permalinks are disabled.

#3 @iworks
8 years ago

Here is a patch - I added a check wp_get_post_parent_id and made a exception in feed url for unattached attachments.

@iworks
8 years ago

#4 @wonderboymusic
8 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to wonderboymusic
  • Status changed from new to assigned

#5 @wonderboymusic
8 years ago

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

In 34336:

Feeds/Links: fix feed links for unattached attachments.

Adds unit tests.

Props wonderboymusic, iworks.
Fixes #33693.

#6 @netweb
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Test Tests_Link_GetPostCommentsFeedLink::test_attachment_no_name_pretty_link via r34336 is fails multisite tests

4) Tests_Link_GetPostCommentsFeedLink::test_attachment_no_name_pretty_link
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://example.org/?feed=rss2&p=1149'
+'http://example.org/2015/09/19/post-title-1/attachment/1149/feed/'
/home/travis/build/aaronjorbin/develop.wordpress/tests/phpunit/tests/link/getPostCommentsFeedLink.php:106

Note: The test passes if run as only part of the link group phpunit --group link -c tests/phpunit/multisite.xml but fails when run with the complete multisite tests phpunit -c tests/phpunit/multisite.xml

#7 @wonderboymusic
8 years ago

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

In 34477:

Feeds/Links: after [34336], use a different meat cleaver to fix Rewrite spillage across test cases.

Fixes #33693.

#8 @wonderboymusic
8 years ago

In 34479:

Unit Tests: after [34477], make Tests_Link_GetPostCommentsFeedLink more respectable.

See #33693.

Note: See TracTickets for help on using tickets.