Spoons icon indicating copy to clipboard operation
Spoons copied to clipboard

Seal UserActions url does not substitute query

Open ameddin73 opened this issue 2 years ago • 3 comments

When using Seal UserActions plugin with custom URL, the search term is never properly substituted. Instead, the query is always ${query}.

Here is my config, but I also tested by copying the Leo translate example from the docs and saw the same behavior.

["Google Search"] = {
	url = "https://www.google.com/search?q=${query}",
	icon = "favicon",
	keyword = "g",
},

Strangely, when I experiment with including symbols in the query sometimes it works.

For example:

  • The command g hello fails and openshttps://www.google.com/search?q=$%7Bquery%7D
  • The command g hello% successfully opens https://www.google.com/search?q=hello%25.

ameddin73 avatar Oct 24 '22 23:10 ameddin73

I was able to get it working by making this change on line 279 of seal_useractions.lua:

local query_escaped = row.arg:gsub("%%", "%%%%")
local url = string.gsub(obj.actions[row.actionname].url, "${query}", query_escaped)

Very weird... I'm pretty stumped why this would fix it but it does. Maybe it's an issue with Lua?

Would you like me to open a PR?

ameddin73 avatar Oct 25 '22 21:10 ameddin73

I was having the same issue, the fix @ameddin73's fix worked for me.

damc-dev avatar Nov 03 '22 19:11 damc-dev

There's a PR already: #272 No reaction yet, maybe we could boost this a little.

thomasjachmann avatar Dec 03 '22 00:12 thomasjachmann