From 5aa6a3dbad1e620dba48942c580f5f755100c2e0 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 8 Jun 2020 12:51:59 +0100 Subject: [PATCH] Fixed no-shadow linting errors in oembed controllers --- core/server/api/canary/oembed.js | 12 ++++++------ core/server/api/v2/oembed.js | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/server/api/canary/oembed.js b/core/server/api/canary/oembed.js index 71f952eeb1..5bdaabe75f 100644 --- a/core/server/api/canary/oembed.js +++ b/core/server/api/canary/oembed.js @@ -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 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); diff --git a/core/server/api/v2/oembed.js b/core/server/api/v2/oembed.js index 6ff8928411..0f4b7414c2 100644 --- a/core/server/api/v2/oembed.js +++ b/core/server/api/v2/oembed.js @@ -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 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);