0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Fixed no-shadow linter warnings in image-size.js

This commit is contained in:
Kevin Ansfield 2020-06-16 12:36:43 +01:00
parent 4ca85b7139
commit 86f14c28a1

View file

@ -51,24 +51,24 @@ function _imageSizeFromBuffer(buffer) {
// use probe-image-size to download enough of an image to get it's dimensions // use probe-image-size to download enough of an image to get it's dimensions
// returns promise which resolves dimensions // returns promise which resolves dimensions
function _probeImageSizeFromUrl(url) { function _probeImageSizeFromUrl(imageUrl) {
// probe-image-size uses `request` npm module which doesn't have our `got` // probe-image-size uses `request` npm module which doesn't have our `got`
// override with custom URL validation so it needs duplicating here // override with custom URL validation so it needs duplicating here
if (_.isEmpty(url) || !validator.isURL(url)) { if (_.isEmpty(imageUrl) || !validator.isURL(imageUrl)) {
return Promise.reject(new errors.InternalServerError({ return Promise.reject(new errors.InternalServerError({
message: 'URL empty or invalid.', message: 'URL empty or invalid.',
code: 'URL_MISSING_INVALID', code: 'URL_MISSING_INVALID',
context: url context: imageUrl
})); }));
} }
return probeSizeOf(url, REQUEST_OPTIONS); return probeSizeOf(imageUrl, REQUEST_OPTIONS);
} }
// download full image then use image-size to get it's dimensions // download full image then use image-size to get it's dimensions
// returns promise which resolves dimensions // returns promise which resolves dimensions
function _fetchImageSizeFromUrl(url) { function _fetchImageSizeFromUrl(imageUrl) {
return request(url, REQUEST_OPTIONS).then((response) => { return request(imageUrl, REQUEST_OPTIONS).then((response) => {
return _imageSizeFromBuffer(response.body); return _imageSizeFromBuffer(response.body);
}); });
} }