Fix: Handle trailing slash for status page routing (#4185)

* Fix: Handle trailing slash

* Chore: Add desc for default slug

* Chore: Use margin instead of space

* Minor
pull/4213/head
Nelson Chan 1 year ago committed by GitHub
parent 65e57e5621
commit 89beb5f264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,12 @@ class StatusPage extends BeanModel {
* @returns {void}
*/
static async handleStatusPageResponse(response, indexHTML, slug) {
// Handle url with trailing slash (http://localhost:3001/status/)
// The slug comes from the route "/status/:slug". If the slug is empty, express converts it to "index.html"
if (slug === "index.html") {
slug = "default";
}
let statusPage = await R.findOne("status_page", " slug = ? ", [
slug
]);

@ -323,6 +323,7 @@
"Accept characters:": "Accept characters:",
"startOrEndWithOnly": "Start or end with {0} only",
"No consecutive dashes": "No consecutive dashes",
"statusPageSpecialSlugDesc": "Special slug {0}: this page will be shown when no slug is provided",
"Next": "Next",
"The slug is already taken. Please choose another slug.": "The slug is already taken. Please choose another slug.",
"No Proxy": "No Proxy",

@ -25,6 +25,9 @@
<mark>a-z</mark> <mark>0-9</mark>
</i18n-t>
<li>{{ $t("No consecutive dashes") }} <mark>--</mark></li>
<i18n-t tag="li" keypath="statusPageSpecialSlugDesc">
<mark class="me-1">default</mark>
</i18n-t>
</ul>
</div>
</div>

Loading…
Cancel
Save