Unscape uri for resolve
This commit is contained in:
parent
dae0f9c3d5
commit
07eaba5a89
2 changed files with 14 additions and 1 deletions
|
@ -79,6 +79,17 @@ function escapeHtmlProperty(property) {
|
||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unscapeHtmlProperty(property) {
|
||||||
|
return property
|
||||||
|
? String(property)
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, "'")
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
// module.exports needed since the web server imports this function
|
// module.exports needed since the web server imports this function
|
||||||
module.exports = {
|
module.exports = {
|
||||||
CONTINENT_COOKIE,
|
CONTINENT_COOKIE,
|
||||||
|
@ -91,4 +102,5 @@ module.exports = {
|
||||||
getParameterByName,
|
getParameterByName,
|
||||||
getThumbnailCdnUrl,
|
getThumbnailCdnUrl,
|
||||||
escapeHtmlProperty,
|
escapeHtmlProperty,
|
||||||
|
unscapeHtmlProperty,
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@ const {
|
||||||
getParameterByName,
|
getParameterByName,
|
||||||
getThumbnailCdnUrl,
|
getThumbnailCdnUrl,
|
||||||
escapeHtmlProperty,
|
escapeHtmlProperty,
|
||||||
|
unscapeHtmlProperty,
|
||||||
} = require('../../ui/util/web');
|
} = require('../../ui/util/web');
|
||||||
const { getJsBundleId } = require('../bundle-id.js');
|
const { getJsBundleId } = require('../bundle-id.js');
|
||||||
const { lbryProxy: Lbry } = require('../lbry');
|
const { lbryProxy: Lbry } = require('../lbry');
|
||||||
|
@ -307,7 +308,7 @@ async function getHtml(ctx) {
|
||||||
ctx.request.url = encodeURIComponent(escapeHtmlProperty(decodeURIComponent(ctx.request.url)));
|
ctx.request.url = encodeURIComponent(escapeHtmlProperty(decodeURIComponent(ctx.request.url)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const requestPath = decodeURIComponent(ctx.path);
|
const requestPath = unscapeHtmlProperty(decodeURIComponent(ctx.path));
|
||||||
if (requestPath.length === 0) {
|
if (requestPath.length === 0) {
|
||||||
const ogMetadata = buildBasicOgMetadata();
|
const ogMetadata = buildBasicOgMetadata();
|
||||||
return insertToHead(html, ogMetadata);
|
return insertToHead(html, ogMetadata);
|
||||||
|
|
Loading…
Reference in a new issue