Skip to content

Commit f405c06

Browse files
Original solution
1 parent 1a9c0f8 commit f405c06

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/mongo/uri/srv_protocol.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ def parse!(remaining)
168168
# The hostname cannot include a port.
169169
#
170170
# The hostname must not begin with a dot, end with a dot, or have
171-
# consecutive dots. The hostname must have a minimum of 3 total
172-
# components (foo.bar.tld).
171+
# consecutive dots. The hostname must have a minimum of 1 component (tld)
173172
#
174173
# Raises Error::InvalidURI if validation fails.
175174
def validate_srv_hostname(hostname)
@@ -185,8 +184,8 @@ def validate_srv_hostname(hostname)
185184
if parts.any?(&:empty?)
186185
raise_invalid_error!("Hostname cannot have consecutive dots: #{hostname}")
187186
end
188-
if parts.length < 3
189-
raise_invalid_error!("Hostname must have a minimum of 3 components (foo.bar.tld): #{hostname}")
187+
if parts.length < 1
188+
raise_invalid_error!("Hostname must have a minimum of 1 component (tld): #{hostname}")
190189
end
191190
end
192191

0 commit comments

Comments
 (0)