Skip to content

Commit

Permalink
fix: don't duplicate path in URL to post on subdirectory installs. (#…
Browse files Browse the repository at this point in the history
…3354)

`baseUrl` includes the path portion of the url, as does `basePath`, which is included in `app.route.x` function outputs. The `baseOrigin` (with no path component at all) should be used instead.
  • Loading branch information
askvortsov1 authored Apr 23, 2022
1 parent b8df386 commit 863a8dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion framework/core/js/src/forum/components/PostMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ export default class PostMeta extends Component {
* @returns {string}
*/
getPermalink(post) {
return app.forum.attribute('baseUrl') + app.route.post(post);
return app.forum.attribute('baseOrigin') + app.route.post(post);
}
}
3 changes: 2 additions & 1 deletion framework/core/src/Api/Serializer/ForumSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ protected function getDefaultAttributes($model)
'description' => $this->settings->get('forum_description'),
'showLanguageSelector' => (bool) $this->settings->get('show_language_selector', true),
'baseUrl' => $url = $this->url->to('forum')->base(),
'basePath' => parse_url($url, PHP_URL_PATH) ?: '',
'basePath' => $path = parse_url($url, PHP_URL_PATH) ?: '',
'baseOrigin' => substr($url, 0, strlen($url) - strlen($path)),
'debug' => $this->config->inDebugMode(),
'apiUrl' => $this->url->to('api')->base(),
'welcomeTitle' => $this->settings->get('welcome_title'),
Expand Down

0 comments on commit 863a8dd

Please sign in to comment.