From 48029fa29f1462ba7eeeefd7efece5d42993cf70 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 2 Mar 2026 16:31:33 -0600 Subject: [PATCH] Website: Update redirects in basic article view action. (#40833) Changes: - Updated the behavior of the view-basic-article action to fix redirects for article URLs with upper case letters. --- website/api/controllers/articles/view-basic-article.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/api/controllers/articles/view-basic-article.js b/website/api/controllers/articles/view-basic-article.js index f5df3fe289..f357b54522 100644 --- a/website/api/controllers/articles/view-basic-article.js +++ b/website/api/controllers/articles/view-basic-article.js @@ -37,7 +37,7 @@ module.exports = { let thisPage = _.find(sails.config.builtStaticContent.markdownPages, { url: this.req.path }); if (!thisPage) {// If there's no EXACTLY matching content page, try a revised version of the URL suffix that's lowercase, with all slashes deduped, and any leading or trailing slash removed (leading slashes are only possible if this is a regex, rather than "/*" route) let revisedPageUrlSuffix = pageUrlSuffix.toLowerCase().replace(/\/+/g, '/').replace(/^\/+/,'').replace(/\/+$/,''); - thisPage = _.find(sails.config.builtStaticContent.markdownPages, { url: '/' + revisedPageUrlSuffix }); + thisPage = _.find(sails.config.builtStaticContent.markdownPages, (page)=>{return _.endsWith(page.url, revisedPageUrlSuffix); }); if (thisPage) {// If we matched a page with the revised suffix, then redirect to that rather than rendering it, so the URL gets cleaned up. throw {redirect: thisPage.url}; } else {// If no page could be found even with the revised suffix, then throw a 404 error.