clean up URLs

This commit is contained in:
infinite-persistence 2022-02-08 21:23:18 +08:00 committed by Thomas Zarebczan
parent 1e7e7a7b7a
commit dbeb102dc4
No known key found for this signature in database
GPG key ID: D505010BDB4364BC

View file

@ -303,6 +303,10 @@ async function getHtml(ctx) {
html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8'); html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
} }
if (ctx?.request?.url) {
ctx.request.url = encodeURIComponent(escapeHtmlProperty(decodeURIComponent(ctx.request.url)));
}
const requestPath = decodeURIComponent(ctx.path); const requestPath = decodeURIComponent(ctx.path);
if (requestPath.length === 0) { if (requestPath.length === 0) {
const ogMetadata = buildBasicOgMetadata(); const ogMetadata = buildBasicOgMetadata();