-
Notifications
You must be signed in to change notification settings - Fork 577
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: Fix multiple query params and pass in fullURL to hs.urlevent's bind callback #3639
Comments
So if I'm understanding correctly, you're opening a URL that looks something like (Imagine you had Irrelevant details of why the parameter gets lostTo build the hammerspoon/extensions/urlevent/liburlevent.m Lines 135 to 147 in 56b5835
For instance, if you're using a userscript to prefix the links.forEach((l) => {
// instead of just concatenating…
// l.href = 'hammerspoon://openInDefaultBrowser?ref=' + l.href
// …encode the original URL first:
l.href = 'hammerspoon://openInDefaultBrowser?ref=' + encodeURIComponent(l.href)
}) Once the parameters are encoded properly, Hammerspoon should automatically handle decoding them before putting them into the Passing the full URL through to One other thing, not directly related to the original issue: It is possible to quote a string so that it can be safely passed to a shell command:
But in this case it's easier and safer to skip the shell, just use Footnotes
|
Thank you so for taking the time to provide detailed explanation and education! Really appreciate it.
Great! Thanks for the better recommendation. Adopted this now.
Got it, this makes sense.
Yup, I noticed that it was already passed to the other handlers. So created #3640 to pass it in for urlevent case as well. I'm currently using this build on my laptop and it's working well. |
Hi, I'm trying to implement something very similar to https://bargsten.org/wissen/custom-protocol-handler-macos/ to open links in the default browser, from within a Chrome PWA. I use the bind url handler to have hammerspoon open a URL in the default browser. The lua script for this handler is very simple and is as follows
I noticed two problems when using it:
ref
.https://example.com/ -> works
https://example.com?k=v -> does not work
hammerspoon/extensions/urlevent/urlevent.lua
Line 77 in 56b5835
This way, even if issue 1 is not fixed, I can handle that case in my handler code
The text was updated successfully, but these errors were encountered: