Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

Problem with callback when image deleted #2

Closed applecat closed 10 years ago

applecat commented 10 years ago

In my code I try to delete image from cloudinary this way:

Meteor.call("cloudinary_delete", image.public_id);

Image successfully deletes, but in console I see:

/Users/dimus/.meteorite/packages/cloudinary/Lepozepo/cloudinary/037bd59917c2d59a22761e64b5d4cf0cfe58c519/.build/npm/node_modules/cloudinary/lib/api.coffee:298
          return callback(result);
                 ^
TypeError: undefined is not a function
    at IncomingMessage.<anonymous> (/Users/dimus/.meteorite/packages/cloudinary/Lepozepo/cloudinary/037bd59917c2d59a22761e64b5d4cf0cfe58c519/.build/npm/node_modules/cloudinary/lib/api.coffee:298:18)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

I think problem is somewhere out here:

server.js

    cloudinary_delete:function(public_id){
        //This isn't very safe, lol
        this.unblock();
        Cloudinary.api.delete_resources([public_id]);
    },

api.coffee

exports.delete_resources = (public_ids, callback, options={}) ->
  resource_type = options["resource_type"] ? "image"
  type = options["type"] ? "upload"    
  uri = ["resources", resource_type, type]
  call_api("delete", uri, _.extend({"public_ids[]": public_ids}, only(options, "keep_original")), callback, options)      

There is not callback set in Cloudinary.api.delete_resources call.

Can you comment on that?

Lepozepo commented 10 years ago

I'll check up on it as soon as I can ^_^

Lepozepo commented 10 years ago

520dfae06dd5421e187c6c6ea44c0bdf6afec241 should fix this. Let me know if you have any other issues with it though. ^_^