Skip to content

Commit 646e1f3

Browse files
authored
fix: Fixes missing Netlify Host check (#50)
# Description The NETLIFY_HOST as fixed in #47 only captured 1 instance where it was used in 2 different locations. This fixes the second location ## Issue Ticket Number <!-- Specifiy which issue this fixes by referencing the issue number (`#11`) or issue URL. --> <!-- Example: Fixes #1 --> Fixes #45 ## Type of change <!-- Please select all options that are applicable. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # Checklist <!-- These must all be followed and checked. --> - [ ] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [ ] I have created an [issue](https://github.com/colbyfayock/netlify-plugin-cloudinary/issues) ticket for this PR - [ ] I have checked to ensure there aren't other open [Pull Requests](https://github.com/colbyfayock/netlify-plugin-cloudinary/pulls) for the same update/change? - [ ] I have performed a self-review of my own code - [ ] I have run tests locally to ensure they all pass - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes needed to the documentation
1 parent 024d7bd commit 646e1f3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ module.exports = {
2525
async onBuild({ netlifyConfig, constants, inputs, utils }) {
2626
console.log('[Cloudinary] Creating redirects...');
2727

28-
const { PUBLISH_DIR } = constants;
29-
3028
const isProduction = process.env.CONTEXT === 'production';
3129
const host = isProduction ? process.env.NETLIFY_HOST : process.env.DEPLOY_PRIME_URL;
3230

3331
console.log(`[Cloudinary] Using host: ${host}`);
3432

33+
const { PUBLISH_DIR } = constants;
34+
3535
const {
3636
deliveryType,
3737
uploadPreset,
@@ -155,7 +155,10 @@ module.exports = {
155155
async onPostBuild({ constants, inputs, utils }) {
156156
console.log('[Cloudinary] Replacing on-page images with Cloudinary URLs...');
157157

158-
const host = process.env.DEPLOY_PRIME_URL || process.env.NETLIFY_HOST;
158+
const isProduction = process.env.CONTEXT === 'production';
159+
const host = isProduction ? process.env.NETLIFY_HOST : process.env.DEPLOY_PRIME_URL;
160+
161+
console.log(`[Cloudinary] Using host: ${host}`);
159162

160163
if ( !host ) {
161164
console.warn(`[Cloudinary] ${ERROR_NETLIFY_HOST_UNKNOWN}`);
@@ -166,7 +169,6 @@ module.exports = {
166169
const { PUBLISH_DIR } = constants;
167170
const {
168171
deliveryType,
169-
loadingStrategy,
170172
uploadPreset,
171173
folder = process.env.SITE_NAME
172174
} = inputs;

0 commit comments

Comments
 (0)