coddingtonbear / obsidian-local-rest-api

Unlock your automation needs by interacting with your notes in Obsidian over a secure REST API.
MIT License
607 stars 56 forks source link

Non-ascii folder names are not supported #13

Closed beaussan closed 2 years ago

beaussan commented 2 years ago

Hi,

I have emoji in my folder names (in order to replicate notion's folder icons), and from some initial testing, there seems to be some issue with that :

GET on /vault/filename

Yield to the following error in the obsidian console : node:internal/errors:464 Uncaught (in promise) TypeError: Invalid character in header content ["Content-Disposition"]

GET on /periodic/period

Yield the following error in the obsidian console :
TypeError: Invalid character in header content ["Content-Location"]


All request were done on the provided swagger UI, and all requests hangs instead of returning a 500 error, maybe that can also be a improvement ?

And I want to say, I love the idea of the plugin, there is soo much potential to be plugged to external tools, but since nearly all of my files are in a folder that contains a emoji name, I'm not able to use this plugin

beaussan commented 2 years ago

Thanks for fixing the first one (/vault/filename), however the one with the content-location header still breaks, maybe applying the same escape system ? (here should do the trick )

Reproduction :
GET /periodic/daily With a folder name "🖊️ journal/"

Workaround : using the /vault/filename works

I can open a PR if you want

coddingtonbear commented 2 years ago

Ok; this might be fixed in a27c603 now (release 1.3.5); if it's not, I'm afraid I might need you to post a pull request.

beaussan commented 2 years ago

It works perfectly !! :tada: Thank you a lot ! Now I can experiment to create workflow using the api :heart:

ngirard commented 2 years ago

Now I can experiment to create workflow using the api

This tickles my curiosity... would you mind expanding on that ? Cheers !

beaussan commented 2 years ago

This tickles my curiosity... would you mind expanding on that ? Yes, some of my plans includes

I could use the filesystem for all of this, but it makes it easier it easier to do in a distributed manner (as in I can have a full time running server to receive the webhooks and then do pulling after it's stored once Obsidian is up)