Escape/encode referrerQuery
This commit is contained in:
parent
5cf78e792b
commit
3744f26295
1 changed files with 3 additions and 3 deletions
|
@ -204,10 +204,10 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}, referrerQuery) {
|
||||||
head += `<link rel="canonical" content="${claimPath}"/>`;
|
head += `<link rel="canonical" content="${claimPath}"/>`;
|
||||||
head += `<link rel="alternate" type="application/json+oembed" href="${URL}/$/oembed?url=${encodeURIComponent(
|
head += `<link rel="alternate" type="application/json+oembed" href="${URL}/$/oembed?url=${encodeURIComponent(
|
||||||
claimPath
|
claimPath
|
||||||
)}&format=json${referrerQuery ? `&r=${referrerQuery}` : ''}" title="${title}" />`;
|
)}&format=json${referrerQuery ? `&r=${encodeURIComponent(referrerQuery)}` : ''}" title="${title}" />`;
|
||||||
head += `<link rel="alternate" type="text/xml+oembed" href="${URL}/$/oembed?url=${encodeURIComponent(
|
head += `<link rel="alternate" type="text/xml+oembed" href="${URL}/$/oembed?url=${encodeURIComponent(
|
||||||
claimPath
|
claimPath
|
||||||
)}&format=xml${referrerQuery ? `&r=${referrerQuery}` : ''}" title="${title}" />`;
|
)}&format=xml${referrerQuery ? `&r=${encodeURIComponent(referrerQuery)}` : ''}" title="${title}" />`;
|
||||||
|
|
||||||
if (mediaType && (mediaType.startsWith('video/') || mediaType.startsWith('audio/'))) {
|
if (mediaType && (mediaType.startsWith('video/') || mediaType.startsWith('audio/'))) {
|
||||||
const videoUrl = generateEmbedUrl(claim.name, claim.claim_id);
|
const videoUrl = generateEmbedUrl(claim.name, claim.claim_id);
|
||||||
|
@ -369,7 +369,7 @@ async function getHtml(ctx) {
|
||||||
if (!requestPath.includes('$')) {
|
if (!requestPath.includes('$')) {
|
||||||
const claimUri = normalizeClaimUrl(requestPath.slice(1));
|
const claimUri = normalizeClaimUrl(requestPath.slice(1));
|
||||||
const claim = await resolveClaimOrRedirect(ctx, claimUri);
|
const claim = await resolveClaimOrRedirect(ctx, claimUri);
|
||||||
const referrerQuery = getParameterByName('r', ctx.request.url);
|
const referrerQuery = escapeHtmlProperty(getParameterByName('r', ctx.request.url));
|
||||||
|
|
||||||
if (claim) {
|
if (claim) {
|
||||||
const ogMetadata = buildClaimOgMetadata(claimUri, claim, {}, referrerQuery);
|
const ogMetadata = buildClaimOgMetadata(claimUri, claim, {}, referrerQuery);
|
||||||
|
|
Loading…
Reference in a new issue