url-lib: don't add existing handlers multiple times
Every time url-lib gets imported we end up making the list of handlers longer with redundant entries. That's silly - we shouldn't add items that already exist. Note that this means you'll have to manipulate the handler list yourself if you want to change the position/priority of existing handlers.master
parent
689c3e1fcd
commit
c6a91ec992
|
@ -43,6 +43,7 @@ add_url_handler() {
|
||||||
local schemes="$@" scheme=""
|
local schemes="$@" scheme=""
|
||||||
set --
|
set --
|
||||||
for scheme in $schemes; do
|
for scheme in $schemes; do
|
||||||
|
[ "$(get_url_handler $scheme)" = "$handler" ] && continue
|
||||||
set -- "$@" "$scheme:$handler"
|
set -- "$@" "$scheme:$handler"
|
||||||
done
|
done
|
||||||
set -- $@ $url_handler_map # add new items to *front* of list
|
set -- $@ $url_handler_map # add new items to *front* of list
|
||||||
|
|
Loading…
Reference in New Issue