sophie-glk / bang

A firefox addon which adds bangs (known from duckduckgo) to various search engines.
MIT License
46 stars 5 forks source link

First occurence of "bang" is replaced instead of the correct "bang" #18

Closed melusc closed 3 years ago

melusc commented 3 years ago

Examples

!banggood foobar: actual: https://www.foobargood.com/index.php?keywords=bang&cat_id=0&com=search expected: https://www.banggood.com/index.php?keywords=foobar&cat_id=0&com=search

!tbbtwiki foobar: actual: https://bigfoobartheory.wikia.com/wiki/Special:Search?search=bang&fulltext=Search&ns0=1&ns14=1# expected: https://bigbangtheory.wikia.com/wiki/Special:Search?search=foobar&fulltext=Search&ns0=1&ns14=1#

~Also !bkkpost foo doesn't work, maybe for the same reason as above?~

babastienne commented 3 years ago

Looks like when the bang refers to a website that contains the text "bang" inside, it is replaced by the search string.

That is an unusual bug, but still reproducible on my environment. I would love to fix it but i'm not really great with javascript and I don't know how to test locally on my machine to be sure that my fix works.

melusc commented 3 years ago

I just checked and !bkkpost doesn't work because bang.json is not up-to-date.

babastienne commented 3 years ago

Yep, but it doesn't explain the bug for the two other bangs. I bet that if we add the !bkkpost by updating th ebang.json file it will still create a bug the same way the two others are.

melusc commented 3 years ago

I guess one way to fix the issue would be to use something like {{{s}}} as a placeholder, which is how ddg does it in their bang suggestion form (https://duckduckgo.com/newbang).

sophie-glk commented 3 years ago

This should be fixed now, pls checkout the current development version from the develop branch

melusc commented 3 years ago

Yep, everything works perfectly now.