Creling / obsidian-image-uploader

MIT License
37 stars 7 forks source link

unsigned upload to cloudinary - guidance needed #12

Closed recspert closed 1 year ago

recspert commented 1 year ago

I'm trying to configure uploads via cloudinary api. I followed instructions in another plugin to enable unsigned uploads as described here.

Now, I'm trying to configure the plugin settings. Currently I have: Api Endpoint

https://api.cloudinary.com/v1_1/<my_account_name>/image/upload

Upload Header

 (empty)

Upload Body

{
  "file": "$FILE",
  "api_key": "<my_cloudinary_api_key>",
  "upload_preset": "<my_preset_name>"
}

When I try to paste an image in an obsidian note the app simply freezes. I have to kill obsidian process. What should I modify to make the plugin work as expected?

Creling commented 1 year ago

Hi, I never heard of cloudinary before. I am now registering a cloudinary account to dig out what happened. :)

recspert commented 1 year ago

Thanks a lot!

They have an example on POSTMAN, here's the direct link

I used their example, and was able to successfully upload an image.

I used the following parameters: file: \<uploaded local file> upload_preset: \<my upload preset for obisian> api_key: \<my cloudinary api key>

And it worked fine. :) I also tried to provide the same info in the Upload body field in the plugin, but it still hangs.

Note, I updated my initial description: removed timestamp field, added api_key field, as these are the settings that worked for me in the POSTMAN

Creling commented 1 year ago

Hey, I find the reason. Please add a {} to the Upload Header filed, then it will work.

image

image

The current version cannot handle null Upload Header. I will fix it in the next version.

Thank you for your feedback. :)

Creling commented 1 year ago

BTW, this is my upload_preset setting:

image

And this is my obsidian-image-uploader setting:

image

I will disable this upload_preset several hours later for security reasons.

recspert commented 1 year ago

Wow! That was quick! :) It works! Thanks a lot!

I had similar settings for the unsigned upload. Thanks for confirming!

Creling commented 1 year ago

LoL, have a nice day. I will close this issue.