mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: preserve github fragment URL
This commit is contained in:
@@ -34,6 +34,7 @@ class FinalDestination
|
||||
|
||||
@opts = opts || {}
|
||||
@force_get_hosts = @opts[:force_get_hosts] || []
|
||||
@preserve_fragment_url_hosts = @opts[:preserve_fragment_url_hosts] || []
|
||||
@opts[:max_redirects] ||= 5
|
||||
@opts[:lookup_ip] ||= lambda { |host| FinalDestination.lookup_ip(host) }
|
||||
|
||||
@@ -59,6 +60,7 @@ class FinalDestination
|
||||
@limited_ips = []
|
||||
@verbose = @opts[:verbose] || false
|
||||
@timeout = @opts[:timeout] || nil
|
||||
@preserve_fragment_url = @preserve_fragment_url_hosts.any? { |host| hostname_matches?(host) }
|
||||
end
|
||||
|
||||
def self.connection_timeout
|
||||
@@ -210,6 +212,7 @@ class FinalDestination
|
||||
|
||||
if location
|
||||
old_port = @uri.port
|
||||
location = "#{location}##{@uri.fragment}" if @preserve_fragment_url && @uri.fragment.present?
|
||||
location = "#{@uri.scheme}://#{@uri.host}#{location}" if location[0] == "/"
|
||||
@uri = uri(location)
|
||||
@limit -= 1
|
||||
|
Reference in New Issue
Block a user