mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: origins_to_regexes should always return an array (#15589)
If the SiteSetting `allowed_onebox_iframes` contains a value of `*`, it will use the values of `all_iframe_origins` during the Oneboxing process. If `all_iframe_origins` itself contains a value of `*`, `origins_to_regexes` will try to return a "catch-all" regex. Other code assumes `origins_to_regexes`will return an array, so this change ensures the `*` case will return an array containing only the catch-all regex.
This commit is contained in:
@ -17,7 +17,8 @@ module Onebox
|
||||
end
|
||||
|
||||
def self.origins_to_regexes(origins)
|
||||
return /.*/ if origins.include?("*")
|
||||
return [/.*/] if origins.include?("*")
|
||||
|
||||
origins.map do |origin|
|
||||
escaped_origin = Regexp.escape(origin)
|
||||
if origin.start_with?("*.", "https://*.", "http://*.")
|
||||
|
Reference in New Issue
Block a user