Base_path not being substituted in some cases

AI-generated summary

Base_path not being substituted in some cases

A bug has been reported where %{base_path} is not being substituted in certain instances. Specifically, in the report a post prompt, the URL is not correctly replacing %{base_path} with the actual base path, resulting in a broken link. For example, https://www.example.com/t/topic-title/1234 becomes https://www.example.com/t/topic-title/%%7Bbase_path%7D/guidelines.

This issue has been reproduced on multiple instances, including on the Python forum jeanas, and on meta JammyDodger. However, it appears that %{base_path} is substituted correctly in other cases, such as in the site_settings.tags_listed_by_group instance.

The issue has been fixed in a PR flink91: https://github.com/discourse/discourse/pull/28149.

I’m not sure when this started, but it seems like %{base_path} isn’t being substituted in some instances.

The only place that I’ve seen this so far is the report a post prompt, where the url has the topic id replaced with %%7Bbase_path%7D/guidelines so https://www.example.com/t/topic-title/1234 becomes https://www.example.com/t/topic-title/%%7Bbase_path%7D/guidelines.

I tested and verified that this also happens in safe mode.

The text of post_action_types.inappropriate.description is the default:

This post contains content that a reasonable person would consider offensive, abusive, to be hateful conduct or a violation of <a href="%{base_path}/guidelines">our community guidelines</a>.

I tested changing the text while keeping the link the same. The changes do appear, but the issue is still there.

I checked another instance of %{base_path}, specifically site_settings.tags_listed_by_group which does appear to substitute correctly. The tags listed by group site setting does have a working link in the description.

4 Likes

This was also reported on the Python forum: "community guidelines" link doesn't work - Discourse Feedback - Discussions on Python.org

3 Likes

Just to pull the Python post over here for visibility:

When I click the flag icon under a post, a dialog pops up and the “our community guidelines” link doesn’t work. Tapping it doesn’t do anything, and when I open it in another tab, I get a “400 Bad Request” error page. Example URL: https://discuss.python.org/t/my-code-as-a-for-loop-that-dont-work/%{base_path}/guidelines

I can repro the issue with ‘community guidelines’ here on meta as well. I’ll slip this over to Contribute > Bug. :+1:

Fixed in this PR:
https://github.com/discourse/discourse/pull/28149

2 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.