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
This commit is contained in:
Nelson Chan
2023-12-11 03:05:13 +08:00
committed by GitHub
parent 65e57e5621
commit 89beb5f264
3 changed files with 10 additions and 0 deletions

View File

@@ -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
]);