obsidian-advanced-uri icon indicating copy to clipboard operation
obsidian-advanced-uri copied to clipboard

"Copy Advanced URI" produces extra %25 characters when copied from Obsidian file menu thingy

Open wealthychef1 opened this issue 2 years ago • 2 comments

I have a file in my vault for which the advanced uri is obsidian://advanced-uri?vault=wealthyvault&filepath=Knowledge%252FArt%252C%2520Spirituality%252C%2520Psychology%252FEmotional%2520Journal.md

The path being encoded is: "Knowledge/Art, Spirituality, Psychology/Emotional Journal|Emotional Journal.md" As you can see if you look closely, the %25 character is being tossed in there a lot, which evaluates to '%' of course, and this extra level of embedding seems to contradict the documentation about encoding.
I have an open ticket with the developer of Keyboard Maestro and the question has come up about why the URIs are formatted with this extra level of %25 encoding.
So the question is, why are the URI's this way, and is it a mistake or should the documentation be changed?
Thanks!

wealthychef1 avatar Jul 14 '22 23:07 wealthychef1

I had some cases (e.g. launching from terminal https://vinzent03.github.io/obsidian-advanced-uri/concepts/encoding), where double encoding solved the issue. I'm wondering that double encoding causes invalid urls for you.

Vinzent03 avatar Jul 16 '22 20:07 Vinzent03

Actually, I do see valid use cases for double encoding but I wanted to confirm with you that this is intentional behavior. Someone on the other forum is arguing that this is somehow not correct behavior and I now am of the belief that there is nothing at all wrong with it, it evaluates correctly to only one result.
So clearly you are double-encoding it on purpose. I'm curious, is this in some way a standard Obsidian scheme or just useful for your plugin. I'm not complaining by the way, it seems reasonable to me to do what you're doing and I even thought of a "vanilla" use case for doing it. Suppose you have a file called "%2F.html" on your server, then the URL is 'https://wealthychef.net/%252F.html'

wealthychef1 avatar Jul 16 '22 20:07 wealthychef1

Hi, I'm having issues with double encoding. The plugin kind of defeats it's purpose for me when I have to 'correct' all double encoded symbols. I want to get the URI of different Obsidian notes, to open them as URL's. With double encoding, this doesn't work out of the box. Also, some other symbols aren't getting encoded. My vault has a & in the name, but I have to manually encode it as %26 to make the link work.

Maybe you could make double encoding optional, and encode other symbols as well? Maybe add some options to enable/disable double encoding, and/or to override how certain symbols should be encoded?

Pachtjuilaard avatar Oct 09 '22 14:10 Pachtjuilaard

@Pachtjuilaard Oh you are right, the vault parameter isn't encoded. How do you open the links that the double encoding causes issues?

Vinzent03 avatar Oct 09 '22 14:10 Vinzent03

@Vinzent03 What I would like to happen is to just get the URI for a note using the "copy URI for current file" command, paste that in the URL bar of any web browser, and open a note that way.

Example: I have a note to some D&D Character Sheet in Obsidian, called Sinker. The "copy URI for current file" gives obsidian://advanced-uri?vault=D&D%20Obsidian&filepath=D%2526D%2520Obsidian%2520Shared%252FCore%252FCampaigns%252FSword%2520Coast%2520Buccaneers%252FCharacters%252FSinker%252FSinker.md

Now, I have to paste that into some text editor, find and replace all cases of "%2520" and turn it into "%20", and I have to change the "&" in the vault name to %26.

Thanks for looking into it!

Pachtjuilaard avatar Oct 10 '22 07:10 Pachtjuilaard

I have no issues opening an uri containing double encoded & and in Firefox on Linux. Only fixing the vault encoding and leaving the rest as it is doesnt work? Which browser and os are you using?

Vinzent03 avatar Oct 10 '22 10:10 Vinzent03

Seems like I didn't test well enough! Only changing the & into %26 resolves the problem for me as well, regardless of browser.

Pachtjuilaard avatar Oct 11 '22 06:10 Pachtjuilaard

Then I will publish the vault fix and your issue is solved.

Vinzent03 avatar Oct 11 '22 07:10 Vinzent03