Fix broken Search Page OG

The changes to escape characters causes `ctx.query` to be nulled.

As a quick fix, stash that value early on.
This commit is contained in:
infinite-persistence 2022-04-13 20:01:59 +08:00 committed by Thomas Zarebczan
parent a50b538ad5
commit e9214be2c1

View file

@ -321,7 +321,9 @@ async function getHtml(ctx) {
html = fs.readFileSync(path.join(__dirname, '/../dist/index.html'), 'utf8');
}
const query = ctx.query;
const requestPath = unscapeHtmlProperty(decodeURIComponent(ctx.path));
if (requestPath.length === 0) {
const ogMetadata = buildBasicOgMetadata();
return insertToHead(html, ogMetadata);
@ -371,7 +373,7 @@ async function getHtml(ctx) {
const categoryMetaFn = getCategoryMetaRenderFn(requestPath);
if (categoryMetaFn) {
const categoryMeta = categoryMetaFn(ctx.request.query);
const categoryMeta = categoryMetaFn(query);
const categoryPageMetadata = buildOgMetadata({
...categoryMeta,
path: requestPath,