Skip to content

Commit b4bf8c1

Browse files
committed
1 parent a84706b commit b4bf8c1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/uri/ldap.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def initialize(*arg)
118118

119119
# Private method to cleanup +dn+ from using the +path+ component attribute.
120120
def parse_dn
121+
raise InvalidURIError, 'bad LDAP URL' unless @path
121122
@dn = @path[1..-1]
122123
end
123124
private :parse_dn

test/uri/test_ldap.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def test_select
9595
u.select(:scheme, :host, :not_exist, :port)
9696
end
9797
end
98+
99+
def test_parse_invalid_uri
100+
assert_raise(URI::InvalidURIError) {URI.parse("ldap:https://example.com")}
101+
end
98102
end
99103

100104

0 commit comments

Comments
 (0)