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

URL from UI Configuration gets saved differently #169

Open
bobbolous opened this issue Sep 16, 2024 · 10 comments
Open

URL from UI Configuration gets saved differently #169

bobbolous opened this issue Sep 16, 2024 · 10 comments
Assignees
Labels
bug Something isn't working duplicate This issue or pull request already exists enhancement New feature or request

Comments

@bobbolous
Copy link

bobbolous commented Sep 16, 2024

I have a ICS calendar with a URL like this (removed some information)
https://<thisWasRemoved>/api/ical?street=L%C3%A4ngestrasse&streetnr=123

after entering this into the UI I get an error log, that this URL is not reachable.
https://<thisWasRemoved>/api/ical?street=L%25C3%25A4ngestrasse&streetnr=123

As you see there was a "25" added ("...L%25C..." instead of "...L%C...").
Background: originally this is a streetname that includes a german "ä".

I am running on 5.0.3.

@franc6
Copy link
Owner

franc6 commented Sep 16, 2024

When entering URLs in the UI, please enter it using UTF-8 characters. The UI will encode the characters properly for the URL.

This is in my TODO list to update, so users can enter the URL either way, but it’s not there yet. :(

@franc6 franc6 self-assigned this Sep 16, 2024
@franc6 franc6 added bug Something isn't working enhancement New feature or request labels Sep 16, 2024
@bobbolous
Copy link
Author

Thanks for your fast response.
As I understand it the URL I am entering is already UTF-8. The "ä" was merely as a background information.
The URL https://<thisWasRemoved>/api/ical?street=L%C3%A4ngestrasse&streetnr=123 contains the percent notation of "ä" in UTF-8 (%C3%A4).

I think the % in the URL is rewritten to %25 as this is the percent notation of %.
https://en.wikipedia.org/wiki/Percent-encoding#Percent_character

@troed
Copy link

troed commented Sep 16, 2024

I'm seeing this as well with a URL from Proton Calendar. % is being rewritten.

@franc6
Copy link
Owner

franc6 commented Sep 16, 2024

I meant to enter it as UTF-8 as opposed to entering it already URL-encoded. For your case, @bobbolous, that would mean https://<thisWasRemoved>/api/ical?street=Längestrasse&streetnr=123

There was a request (via PR #133) back in June to allow entering emojis directly instead of URL encoding them. This directly conflicts with what you're entering, and while there is a simple way around that, the simple fix might not match well with a good fix, so my current compromise is to keep the conflict until a proper fix is provided. See also TODO.md. I know it could be a while, but I really hope to get to it sooner than it took 5.0 to be released, since all of the 5.x items really, really annoy me. And the bugs that annoy me tend to get fixed faster. :)

Please note if this conflict is one you don't want to deal with, look in config_flow.py, search for "safe", and change safe=":/?&=" to be safe=":/?&=%". That's the simple fix.

@troed
Copy link

troed commented Sep 16, 2024

Thank you for the workaround - it works well. I do think asking users to reverse URL-encoding they get from their calendar services is a bit too much to ask but I understand your conflicting requests :D

@franc6
Copy link
Owner

franc6 commented Sep 16, 2024

@troed I don’t disagree with you. :(. But thanks for your understanding. I greatly appreciate it.

@bobbolous
Copy link
Author

bobbolous commented Sep 16, 2024

Thanks for the great support!
Using https://<thisWasRemoved>/api/ical?street=Längestrasse&streetnr=123 worked.

@LPirro
Copy link

LPirro commented Sep 20, 2024

@franc6 I have a similar issue setting up my calendar from the UI:

I have this calendar URL from Google (I obfuscated the key with x below but they are only letters and numbers, not special characters).

Correct URL:
https://calendar.google.com/calendar/ical/username%40gmail.com/private-xxxxxxxxxxxxxxxxxxxxxx/basic.ics

URL added by the plugin:
https://calendar.google.com/calendar/ical/username%2540gmail.com/private-xxxxxxxxxxxxxxxxxxxxxx/basic.ics

you can see that the error is here username%2540 (25 gets added but it's not present in the correct url).

Thanks

@franc6
Copy link
Owner

franc6 commented Sep 20, 2024

@LPirro For now, you can replace %40 with @

@franc6 franc6 added the duplicate This issue or pull request already exists label Oct 20, 2024
@RafaelSchridi
Copy link

Same thing happens with Proton Calendar and %3D needing to be changed to =

franc6 added a commit that referenced this issue Jan 20, 2025
…L isn't encoded. (#224)

Fixes #116, #133, #169, #211

Description of change:

## Formatting, testing, and code coverage
Please note your pull request won't be accepted if you haven't properly
formatted your source code, and ensured the unit tests are appropriate.
Please note if you are not running on Windows, you can either run the
scripts via a bash installation (like git-bash).

- [X] formatstyle.sh reports no errors
- [X] All unit tests pass (test.sh)
- [X] Code coverage has not decreased (test.sh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants