File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " netlify-plugin-cloudinary" ,
3
- "version" : " 0.0.10-beta.2 " ,
3
+ "version" : " 0.0.10-beta.5 " ,
4
4
"description" : " " ,
5
5
"main" : " src/index.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ module.exports = {
20
20
21
21
async onBuild ( { netlifyConfig, constants, inputs } ) {
22
22
const { FUNCTIONS_SRC , INTERNAL_FUNCTIONS_SRC } = constants ;
23
- const { uploadPreset, deliveryType } = inputs ;
23
+ const { uploadPreset, deliveryType, folder = process . env . SITE_NAME } = inputs ;
24
24
25
25
const cloudName = process . env . CLOUDINARY_CLOUD_NAME || inputs . cloudName ;
26
26
@@ -52,8 +52,9 @@ module.exports = {
52
52
53
53
const params = {
54
54
uploadPreset,
55
- deliveryType : 'fetch' ,
56
- cloudName
55
+ deliveryType,
56
+ cloudName,
57
+ folder
57
58
}
58
59
59
60
const paramsString = Object . keys ( params )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ exports.handler = async function (event, context) {
9
9
const pathSegments = rawUrlSegments [ 1 ] . split ( '?' ) ;
10
10
const imagePath = `/cld-assets/images${ pathSegments [ 0 ] } ` ;
11
11
12
- const { deliveryType } = getQueryParams ( rawUrl ) ;
12
+ const { deliveryType, uploadPreset , folder } = getQueryParams ( rawUrl ) ;
13
13
14
14
const cloudName = process . env . CLOUDINARY_CLOUD_NAME || queryParams . cloudName ;
15
15
const apiKey = process . env . CLOUDINARY_API_KEY ;
@@ -25,13 +25,13 @@ exports.handler = async function (event, context) {
25
25
apiSecret
26
26
} ) ;
27
27
28
-
29
- const remoteUrl = encodeURIComponent ( `${ endpoint } ${ imagePath } ` ) ;
28
+ const remoteUrl = `${ endpoint } ${ imagePath } ` ;
30
29
31
30
const cloudinaryUrl = await getCloudinaryUrl ( {
32
31
deliveryType,
33
- path : imagePath ,
34
- remoteHost : endpoint
32
+ folder,
33
+ path : remoteUrl ,
34
+ uploadPreset
35
35
} ) ;
36
36
37
37
console . log ( {
You can’t perform that action at this time.
0 commit comments