Unscape uri for resolve

This commit is contained in:
Rafael 2022-02-08 14:45:19 -03:00 committed by Thomas Zarebczan
parent dae0f9c3d5
commit 07eaba5a89
2 changed files with 14 additions and 1 deletions

View file

@ -79,6 +79,17 @@ function escapeHtmlProperty(property) {
: '';
}
function unscapeHtmlProperty(property) {
return property
? String(property)
.replace(/&/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.replace(/&#039;/g, "'")
: '';
}
// module.exports needed since the web server imports this function
module.exports = {
CONTINENT_COOKIE,
@ -91,4 +102,5 @@ module.exports = {
getParameterByName,
getThumbnailCdnUrl,
escapeHtmlProperty,
unscapeHtmlProperty,
};

View file

@ -19,6 +19,7 @@ const {
getParameterByName,
getThumbnailCdnUrl,
escapeHtmlProperty,
unscapeHtmlProperty,
} = require('../../ui/util/web');
const { getJsBundleId } = require('../bundle-id.js');
const { lbryProxy: Lbry } = require('../lbry');
@ -307,7 +308,7 @@ async function getHtml(ctx) {
ctx.request.url = encodeURIComponent(escapeHtmlProperty(decodeURIComponent(ctx.request.url)));
}
const requestPath = decodeURIComponent(ctx.path);
const requestPath = unscapeHtmlProperty(decodeURIComponent(ctx.path));
if (requestPath.length === 0) {
const ogMetadata = buildBasicOgMetadata();
return insertToHead(html, ogMetadata);