anyrun-org / plugin-websearch

Plugin to search with your preferred search-engine
GNU General Public License v3.0
1 stars 2 forks source link

Wrap url in `'` #2

Open FromWau opened 1 month ago

FromWau commented 1 month ago

This fixes the problem that bash escapes the url string.

Wrap url with '. → Internal command: xdg-open 'url'

Why the wrap?

Example: We want to search for packages (eg: anyrun) in the aur that are not outdated (url: https://aur.archlinux.org/packages?K=anyrun&outdated=off)

user input: anyrun resulting internal string: https://aur.archlinux.org/packages?K=anyrun&outdated=off resulting internal command: xdg-open https://aur.archlinux.org/packages?K=anyrun&outdated=off

running in bash:

xdg-open https://aur.archlinux.org/packages?K=anyrun&outdated=off

we see that the pages opens but &... disappeared. Wrapping the url fixes this:

xdg-open 'https://aur.archlinux.org/packages?K=anyrun&outdated=off'

Fixes #1

00-kat commented 3 weeks ago

By the way this would have an issue with URLs that have a ' in it, for example if you want to wrap your search query in 's...

xdg-open 'https://yourfav.site/page?q=foo+'{}'&bar=baz'