Skip to content

Commit 3b0031a

Browse files
committed
updating params
1 parent 5589bbf commit 3b0031a

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netlify-plugin-cloudinary",
3-
"version": "0.0.10-beta.2",
3+
"version": "0.0.10-beta.5",
44
"description": "",
55
"main": "src/index.js",
66
"scripts": {

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020

2121
async onBuild({ netlifyConfig, constants, inputs }) {
2222
const { FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC } = constants;
23-
const { uploadPreset, deliveryType } = inputs;
23+
const { uploadPreset, deliveryType, folder = process.env.SITE_NAME } = inputs;
2424

2525
const cloudName = process.env.CLOUDINARY_CLOUD_NAME || inputs.cloudName;
2626

@@ -52,8 +52,9 @@ module.exports = {
5252

5353
const params = {
5454
uploadPreset,
55-
deliveryType: 'fetch',
56-
cloudName
55+
deliveryType,
56+
cloudName,
57+
folder
5758
}
5859

5960
const paramsString = Object.keys(params)

src/templates/functions/cld_images.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports.handler = async function (event, context) {
99
const pathSegments = rawUrlSegments[1].split('?');
1010
const imagePath = `/cld-assets/images${pathSegments[0]}`;
1111

12-
const { deliveryType } = getQueryParams(rawUrl);
12+
const { deliveryType, uploadPreset, folder } = getQueryParams(rawUrl);
1313

1414
const cloudName = process.env.CLOUDINARY_CLOUD_NAME || queryParams.cloudName;
1515
const apiKey = process.env.CLOUDINARY_API_KEY;
@@ -25,13 +25,13 @@ exports.handler = async function (event, context) {
2525
apiSecret
2626
});
2727

28-
29-
const remoteUrl = encodeURIComponent(`${endpoint}${imagePath}`);
28+
const remoteUrl = `${endpoint}${imagePath}`;
3029

3130
const cloudinaryUrl = await getCloudinaryUrl({
3231
deliveryType,
33-
path: imagePath,
34-
remoteHost: endpoint
32+
folder,
33+
path: remoteUrl,
34+
uploadPreset
3535
});
3636

3737
console.log({

0 commit comments

Comments
 (0)