mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
FIX: An unresolved blank uri should attempt an alternate Oneboxing strategy, if available (#13070)
This commit is contained in:
parent
8801a27cc6
commit
a24b6daa87
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user