FIX: An unresolved blank uri should attempt an alternate Oneboxing strategy, if available (#13070)

FIX: An unresolved blank uri should attempt an alternate Oneboxing strategy, if available (#13070)

diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb
index 954e810..239f6b2 100644
--- a/lib/oneboxer.rb
+++ b/lib/oneboxer.rb
@@ -427,12 +427,10 @@ module Oneboxer
         args = { link: url }
         if fd.status == :invalid_address
           args[:error_message] = I18n.t("errors.onebox.invalid_address", hostname: fd.hostname)
-        elsif fd.status_code
+        elsif (fd.status_code || uri.nil?) && available_strategies.present?
           # Try a different oneboxing strategy, if we have any options left:
-          if available_strategies.present?
-            return external_onebox(url, available_strategies)
-          end
-
+          return external_onebox(url, available_strategies)
+        elsif fd.status_code
           args[:error_message] = I18n.t("errors.onebox.error_response", status_code: fd.status_code)
         end
 
diff --git a/spec/components/oneboxer_spec.rb b/spec/components/oneboxer_spec.rb
index fcc0e13..3628e58 100644
--- a/spec/components/oneboxer_spec.rb
+++ b/spec/components/oneboxer_spec.rb
@@ -391,7 +391,7 @@ describe Oneboxer do
         Oneboxer.clear_preferred_strategy!(hostname)
       end
 
-      it "uses mutiple strategies" do
+      it "uses multiple strategies" do
         default_ordered = Oneboxer.strategies.keys
         custom_ordered = Oneboxer.ordered_strategies(hostname)
         expect(custom_ordered).to eq(default_ordered)

GitHub sha: a24b6daa

This commit appears in #13070 which was approved by eviltrout. It was merged by jbrw.