From 9fba73a4ef620908b79d5f66427524b73fbbc386 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Tue, 7 Jul 2020 14:57:58 +1000 Subject: [PATCH] FIX: allowlisted_generic_onebox engine should be last --- lib/onebox/matcher.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/onebox/matcher.rb b/lib/onebox/matcher.rb index f628306e..4978bc3e 100644 --- a/lib/onebox/matcher.rb +++ b/lib/onebox/matcher.rb @@ -16,7 +16,10 @@ def oneboxed uri = URI(@url) return unless uri.port.nil? || Onebox.options.allowed_ports.include?(uri.port) return unless uri.scheme.nil? || Onebox.options.allowed_schemes.include?(uri.scheme) - ordered_engines.find { |engine| engine === uri } + ordered_engines + .select { |engine| engine === uri } + .sort_by { |engine| engine.to_s } + .last rescue URI::InvalidURIError nil end