File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 11import  app  from  "../../leonardo_ai.app.mjs" ; 
2- import  {  axios  }  from  "@pipedream/platform" ; 
32
43export  default  { 
54  key : "leonardo_ai-upload-image" , 
65  name : "Upload Image" , 
76  description : "Uploads a new image to Leonardo AI for use in generations and variations." , 
8-   version : "0.0.8 " , 
7+   version : "0.0.9 " , 
98  type : "action" , 
109  props : { 
1110    app, 
@@ -16,19 +15,19 @@ export default {
1615      options : [ 
1716        { 
1817          label : "PNG" , 
19-           value : "png" 
18+           value : "png" , 
2019        } , 
2120        { 
2221          label : "JPG" , 
23-           value : "jpg" 
22+           value : "jpg" , 
2423        } , 
2524        { 
2625          label : "JPEG" , 
27-           value : "jpeg" 
26+           value : "jpeg" , 
2827        } , 
2928        { 
3029          label : "WebP" , 
31-           value : "webp"   
30+           value : "webp" , 
3231        } , 
3332      ] , 
3433    } , 
@@ -45,16 +44,17 @@ export default {
4544    }  =  this ; 
4645    console . log ( extension ) ; 
4746    // Convert base64 string to Buffer 
48-     const  base64Data  =  file . replace ( / ^ d a t a : i m a g e \/ [ a - z ] + ; b a s e 6 4 , / ,  '' ) ; 
49-     const  buffer  =  Buffer . from ( base64Data ,  ' base64' ) ; 
47+     const  base64Data  =  file . replace ( / ^ d a t a : i m a g e \/ [ a - z ] + ; b a s e 6 4 , / ,  "" ) ; 
48+     const  buffer  =  Buffer . from ( base64Data ,  " base64" ) ; 
5049
5150    // Create a File-like object from the buffer 
5251    const  fileObject  =  { 
5352      buffer : buffer , 
5453      name : `image.${ extension }  ` , 
5554      type : `image/${  
56-         extension  ===  "jpg"  ?  
57-         "jpeg"  : extension  
55+         extension  ===  "jpg"  ? 
56+           "jpeg"  
57+           : extension  
5858      }  `, 
5959    } ; 
6060
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export default {
6464      return  data . custom_models  ||  [ ] ; 
6565    } , 
6666    async  getUploadInitImage ( { 
67-         $,  extension  
67+       $,  extension, 
6868    } )  { 
6969      const  data  =  await  this . post ( { 
7070        $, 
@@ -76,14 +76,14 @@ export default {
7676      return  data ; 
7777    } , 
7878    async  uploadFileToPresignedUrl ( { 
79-         $,  url,  fields,  file  
79+       $,  url,  fields,  file, 
8080    } )  { 
8181      const  formData  =  new  FormData ( ) ; 
8282
8383      // Add all the fields from the presigned URL response 
8484      Object . entries ( fields ) . forEach ( ( [ 
8585        key , 
86-         value          
86+         value , 
8787      ] )  =>  { 
8888        formData . append ( key ,  value ) ; 
8989      } ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments