0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed no-shadow linting errors in oembed controllers

This commit is contained in:
Kevin Ansfield 2020-06-08 12:51:59 +01:00
parent 1d49cba426
commit 5aa6a3dbad
2 changed files with 12 additions and 12 deletions

View file

@ -125,10 +125,10 @@ function fetchOembedData(_url) {
method: 'GET',
timeout: 2 * 1000,
followRedirect: true
}).then((response) => {
}).then((pageResponse) => {
// url changed after fetch, see if we were redirected to a known oembed
if (response.url !== url) {
({url, provider} = findUrlWithProvider(response.url));
if (pageResponse.url !== url) {
({url, provider} = findUrlWithProvider(pageResponse.url));
if (provider) {
return knownProvider(url);
}
@ -137,7 +137,7 @@ function fetchOembedData(_url) {
// check for <link rel="alternate" type="application/json+oembed"> element
let oembedUrl;
try {
oembedUrl = cheerio('link[type="application/json+oembed"]', response.body).attr('href');
oembedUrl = cheerio('link[type="application/json+oembed"]', pageResponse.body).attr('href');
} catch (e) {
return unknownProvider(url);
}
@ -154,10 +154,10 @@ function fetchOembedData(_url) {
json: true,
timeout: 2 * 1000,
followRedirect: true
}).then((response) => {
}).then((oembedResponse) => {
// validate the fetched json against the oembed spec to avoid
// leaking non-oembed responses
const body = response.body;
const body = oembedResponse.body;
const hasRequiredFields = body.type && body.version;
const hasValidType = ['photo', 'video', 'link', 'rich'].includes(body.type);

View file

@ -83,10 +83,10 @@ function fetchOembedData(_url) {
method: 'GET',
timeout: 2 * 1000,
followRedirect: true
}).then((response) => {
}).then((pageResponse) => {
// url changed after fetch, see if we were redirected to a known oembed
if (response.url !== url) {
({url, provider} = findUrlWithProvider(response.url));
if (pageResponse.url !== url) {
({url, provider} = findUrlWithProvider(pageResponse.url));
if (provider) {
return knownProvider(url);
}
@ -95,7 +95,7 @@ function fetchOembedData(_url) {
// check for <link rel="alternate" type="application/json+oembed"> element
let oembedUrl;
try {
oembedUrl = cheerio('link[type="application/json+oembed"]', response.body).attr('href');
oembedUrl = cheerio('link[type="application/json+oembed"]', pageResponse.body).attr('href');
} catch (e) {
return unknownProvider(url);
}
@ -112,10 +112,10 @@ function fetchOembedData(_url) {
json: true,
timeout: 2 * 1000,
followRedirect: true
}).then((response) => {
}).then((oembedResponse) => {
// validate the fetched json against the oembed spec to avoid
// leaking non-oembed responses
const body = response.body;
const body = oembedResponse.body;
const hasRequiredFields = body.type && body.version;
const hasValidType = ['photo', 'video', 'link', 'rich'].includes(body.type);