Correctly handle IPv6 IPs in webhook URLs (#43911, #29664).

Patch by Holger Just (user:hjust).


git-svn-id: https://svn.redmine.org/redmine/trunk@24537 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2026-03-28 10:00:02 +00:00
parent 3a096092e1
commit b9f5d62abc
2 changed files with 9 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ class WebhookEndpointValidator < ActiveModel::EachValidator
return false if uri.nil?
return false unless valid_scheme?(uri.scheme)
return false unless valid_host?(uri.host)
return false unless valid_host?(uri.hostname)
return false unless valid_port?(uri.port)
true

View File

@@ -95,5 +95,13 @@ class WebhookEndpointValidatorTest < ActiveSupport::TestCase
assert h.errors[:url].any?
end
end
%w[
[2001:0db8:85a3:0000:0000:8a2e:0370:7334]
8.8.8.8
].each do |host|
h = TestModel.new "http://#{host}"
assert h.valid?, "URI host #{host} should be valid"
end
end
end