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 = {
|
||||
CONTINENT_COOKIE,
|
||||
|
@ -91,4 +102,5 @@ module.exports = {
|
|||
getParameterByName,
|
||||
getThumbnailCdnUrl,
|
||||
escapeHtmlProperty,
|
||||
unscapeHtmlProperty,
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue