File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
components/cloudinary/actions/upload-media-asset Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change 11import cloudinary from "../../cloudinary.app.mjs" ;
2+ import fs from 'fs' ;
23
34export default {
45 key : "cloudinary-upload-media-asset" ,
@@ -74,11 +75,6 @@ export default {
7475 } ,
7576 } ,
7677 async run ( { $ } ) {
77- let file = this . file ;
78- if ( typeof file === 'string' && file . match ( / ^ \/ ? t m p / ) ) {
79- file = fs . createReadStream ( file ) ;
80- }
81-
8278 const options = {
8379 public_id : this . publicId ,
8480 folder : this . folder ,
@@ -98,12 +94,12 @@ export default {
9894 } ;
9995
10096 try {
101- const response = await this . cloudinary . uploadMedia ( file , options ) ;
97+ const response = await this . cloudinary . uploadMedia ( this . file , options ) ;
10298 if ( response ) {
10399 $ . export ( "$summary" , "Successfully uploaded media asset" ) ;
104100 }
105101 return response ;
106- } catch ( e ) {
102+ } catch ( err ) {
107103 throw new Error ( `Cloudinary error response: ${ err . error ?. message ?? JSON . stringify ( err ) } ` ) ;
108104 }
109105 } ,
You can’t perform that action at this time.
0 commit comments