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
[fix] get_bang_url: handle ambiguous !!bangs without error #740
Conversation
An ambiguous bang like `!!d` raises an exception in function get_bang_url(). A bang is only unique when the bang_definition from get_bang_definition_and_ac() is a string / for a ambiguous bang the returned bang_definition is a dictionary. Reported-by: user prg at #searxng:matrix.org on 2022/01/11 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This PR need some more work, the initial issue is fixed but there is another issue: Bangs with a {
"c":"Online Services",
"d":"www.joindiaspora.com",
"r":0,
"s":"Diaspora*",
"sc":"Social",
"t":"d*",
"u":"https://www.joindiaspora.com/people?utf8=\u2713&q={{{s}}}"
} will overwrite bangs with the same prefix, e.g. {
"c":"Research",
"d":"www.thefreedictionary.com",
"r":5478,"s":"The Free Dictionary",
"sc":"Academic",
"t":"d",
"u":"http://www.thefreedictionary.com/{{{s}}}"
} I assume it is caused by the
|
@dalf are you active working on #740 (comment) .. if not, I can have a look. |
Bangs with a `*` suffix (e.g. `!!d*`) overwrite Bangs with the same prefix (e.g. `!!d`) [1]. This can be avoid when a non printable character is used to tag a LEAF_KEY. [1] searxng#740 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Bangs with a `*` suffix (e.g. `!!d*`) overwrite Bangs with the same prefix (e.g. `!!d`) [1]. This can be avoid when a non printable character is used to tag a LEAF_KEY. [1] searxng#740 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Bangs with a `*` suffix (e.g. `!!d*`) overwrite Bangs with the same prefix (e.g. `!!d`) [1]. This can be avoid when a non printable character is used to tag a LEAF_KEY. [1] searxng#740 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Updated external bangs by:: ./manage pyenv.cmd ./searxng_extra/update/update_external_bangs.py Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
Thank you!
What does this PR do?
[fix] get_bang_url: handle ambiguous !!bangs without error
Why is this change important?
An ambiguous bang like
!!d
raises an exception in function get_bang_url(). Abang is only unique when the bang_definition from get_bang_definition_and_ac() is
a string / for a ambiguous bang the returned bang_definition is a dictionary.
How to test this PR locally?
Search for
!!d foo
Related issues
Reported-by: user @prg318 at #searxng:matrix.org on 2022/01/11