Fix embed params regex again

This commit is contained in:
Rafael 2022-02-01 17:49:29 -03:00 committed by Thomas Zarebczan
parent c7a23058c8
commit e37a6c66be

View file

@ -120,8 +120,10 @@ async function getOEmbed(ctx) {
const embedlyReferrer = getParameterByName('referrer', requestUrl); const embedlyReferrer = getParameterByName('referrer', requestUrl);
const decodedQueryUri = decodeURIComponent(urlQuery); const decodedQueryUri = decodeURIComponent(urlQuery);
const hasUrlParams = RegExp(/[?&]\w=/).test(decodedQueryUri);
const claimUrl = hasUrlParams ? decodedQueryUri.substring(0, decodedQueryUri.search(/[?&](?:\w=)?/)) : decodedQueryUri; const paramsRegex = /[?&](?:\w=)?/g;
const hasUrlParams = RegExp(paramsRegex).test(decodedQueryUri);
const claimUrl = hasUrlParams ? decodedQueryUri.substring(0, decodedQueryUri.search(paramsRegex)) : decodedQueryUri;
const { claim, error } = await getClaim(claimUrl); const { claim, error } = await getClaim(claimUrl);