Skip to:
Content

bbPress.org

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#3424 closed defect (bug) (fixed)

bbp_get_reply_url() generates incorrect link for a spammed topic

Reported by: dd32's profile dd32 Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.10 Priority: normal
Severity: normal Version:
Component: Component - Replies Keywords: has-patch
Cc:

Description

bbp_get_reply_url() generates two forms of URLs:

  • https://example.org/topic/test-topic-1/#post-3456
  • https://example.org/?post_type=topic&p=1234#post-3456

The first form is used for non-pending posts, and the latter for pending posts. The idea is that only pending posts will have a not-url-rewrite url, that assumption is incorrect.

Topics which are marked as spam, also have a non-url-rewrites url, and as a result the url that this function will generate for those use-cases is the following:

  • https://example.org/?post_type=topic&p=1234/#post-3456

The trailing slash is incorrectly added, as the logic incorrectly assumes that only pending posts won't have ugly urls.

If view=all is also present, the URL ends up like this:

  • https://example.org/?post_type=topic&p=1234%2F&view=all#post-3456

The attached patch swaps this around to use bbp_is_topic_published() instead of ! bbp_is_topic_pending() which results in all not-published reply links using ugly links, which I think is correct here.

Attachments (2)

3424.diff (1.3 KB) - added by dd32 4 years ago.
3424.02.patch (1.1 KB) - added by johnjamesjacoby 3 years ago.

Download all attachments as: .zip

Change History (8)

@dd32
4 years ago

This ticket was mentioned in Slack in #forums by dd32. View the logs.


4 years ago

#2 @johnjamesjacoby
3 years ago

  • Milestone changed from Awaiting Review to 2.6.10

#3 @johnjamesjacoby
3 years ago

  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#4 @johnjamesjacoby
3 years ago

Should consolidate this pagination code someday 🤔 it's a bit complicated right now 😬

#5 @johnjamesjacoby
3 years ago

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

In 7247:

URLs: fix incorrect links for certain topic statuses.

This change prefers bbp_is_topic_public() over ! bbp_is_topic_pending() to determine whether or not certain reply & topic URLs should be "pretty".

Props dd32.

In branches/2.6, for 2.6.10.

Fixes #3424.

#6 @johnjamesjacoby
3 years ago

In 7248:

URLs: fix incorrect links for certain topic statuses.

This change prefers bbp_is_topic_public() over ! bbp_is_topic_pending() to determine whether or not certain reply & topic URLs should be "pretty".

Props dd32.

In trunk, for 2.7.0.

Fixes #3424.

Note: See TracTickets for help on using tickets.