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

hs.urlevent incorrectly treats scheme in case sensitive manner #3686

Open
von opened this issue Sep 10, 2024 · 3 comments
Open

hs.urlevent incorrectly treats scheme in case sensitive manner #3686

von opened this issue Sep 10, 2024 · 3 comments
Labels
Milestone

Comments

@von
Copy link
Contributor

von commented Sep 10, 2024

With Hammerspoon configured to be the default URL handler via URLDispatcher and trying to open a URL starting with "HTTPS://" I get the following error:

2024-09-10 13:14:11: 13:14:11 ERROR: urlevent: Hammerspoon has been passed a HTTPS URL, but does not know how to handle it

I.e. it looks like URLDispatcher treats "HTTPS" and "https" differently.

I believe, according to 6.2.2.1 of RFC 3986, schemes should be treated in a case-insensitive manner.

@von
Copy link
Contributor Author

von commented Sep 10, 2024

Looks like this is due to hs.urlevent.openURL() - simple demonstration:

> hs.urlevent.openURL("HTTPS://somehost.com/foo/bar")
true
2024-09-10 17:50:18: 17:50:18 ERROR:  urlevent: Hammerspoon has been passed a HTTPS URL, but does not know how to handle it

@cmsj
Copy link
Member

cmsj commented Sep 11, 2024

Good spot, we are indeed doing a case-sensitive comparison:

if (scheme == "http" or scheme == "https" or scheme == "file") then

@cmsj cmsj added the bug label Sep 11, 2024
@cmsj cmsj added this to the 1.0.1 milestone Sep 11, 2024
@cmsj
Copy link
Member

cmsj commented Sep 11, 2024

(although note to anyone who might beat me to fixing this, actually the best place to do it would be in the Objective C side, by converting the scheme and host (but not the other fields) to lowercase: https://github.com/Hammerspoon/hammerspoon/blob/master/extensions/urlevent/liburlevent.m#L150 )

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

No branches or pull requests

2 participants