Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wealthychef1 opened this issue Jul 14, 2022 · 8 comments

Comments

@wealthychef1
Copy link

wealthychef1 commented Jul 14, 2022

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 wealthychef1 changed the title "Copy Advanced URI" produces curiously formatted strings for commas followed by spaces "Copy Advanced URI" produces extra %25 characters when copied from Obsidian file menu thingy Jul 15, 2022
@Vinzent03
Copy link
Owner

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.

@wealthychef1
Copy link
Author

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'

@Pachtjuilaard
Copy link

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?

@Vinzent03
Copy link
Owner

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

@Pachtjuilaard
Copy link

@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!

@Vinzent03
Copy link
Owner

Vinzent03 commented Oct 10, 2022

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?

@Pachtjuilaard
Copy link

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

@Vinzent03
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants