Blogger static page permalink not working when adding slash

does anyone know where the error in my code lies?

//const HOST = “https://www.travelign.nl/p/

async function gatherResponse(response) {
const { headers } = response
const contentType = headers.get(“content-type”) || “”
if (contentType.includes(“application/json”)) {
return JSON.stringify(await response.json())
}
else if (contentType.includes(“application/text”)) {
return await response.text()
}
else if (contentType.includes(“text/html”)) {
return await response.text()
}
else {
return await response.text()
}
}

async function handleRequest(event) {
const init = {
headers: {
“content-type”: “text/html;charset=UTF-8”,
“cache-control”: “public, max-age=86400”
},
}
const url = new URL(event.request.url.replace(’/page/’, ‘/’))
const HOST = ‘https://’ + url.hostname + ‘/p/’
const response = await fetch(${HOST}${url.pathname}.html, init)
const results = await gatherResponse(response)
return new Response(results, init)
}

addEventListener(“fetch”, event => {
event.respondWith(handleRequest(event))
})

I want to change the permalink structure of a static page on a blogger website and it has worked with the code above,

but when I add a slash at the end of the url like this, my website can’t be accessed

https://www.travelign.nl/page/about/

previously like this can be accessed

https://www.travelign.nl/page/about

where is the error in my code above?