diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-30 12:04:15 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-30 12:05:18 +0900 |
commit | e6334fd45064cb720399bf6aa75116ec62a88357 (patch) | |
tree | 497045640944cd6aade42f8ac93463d174ce95c7 | |
parent | 16c5cbe42247fcf253f2dde71f112c707c7dd4fa (diff) | |
download | ruby-e6334fd45064cb720399bf6aa75116ec62a88357.tar.gz |
Unnamed groups are not captured when named groups are used
-rw-r--r-- | lib/net/ftp.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index d1e545c0c8..1f6879d765 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1044,7 +1044,7 @@ module Net TIME_PARSER = ->(value, local = false) { unless /\A(?<year>\d{4})(?<month>\d{2})(?<day>\d{2}) (?<hour>\d{2})(?<min>\d{2})(?<sec>\d{2}) - (\.(?<fractions>\d+))?/x =~ value + (?:\.(?<fractions>\d+))?/x =~ value raise FTPProtoError, "invalid time-val: #{value}" end usec = fractions.to_i * 10 ** (6 - fractions.to_s.size) @@ -1369,7 +1369,7 @@ module Net if !resp.start_with?("227") raise FTPReplyError, resp end - if m = /\((?<host>\d+(,\d+){3}),(?<port>\d+,\d+)\)/.match(resp) + if m = /\((?<host>\d+(?:,\d+){3}),(?<port>\d+,\d+)\)/.match(resp) return parse_pasv_ipv4_host(m["host"]), parse_pasv_port(m["port"]) else raise FTPProtoError, resp @@ -1385,9 +1385,9 @@ module Net if !resp.start_with?("228") raise FTPReplyError, resp end - if m = /\(4,4,(?<host>\d+(,\d+){3}),2,(?<port>\d+,\d+)\)/.match(resp) + if m = /\(4,4,(?<host>\d+(?:,\d+){3}),2,(?<port>\d+,\d+)\)/.match(resp) return parse_pasv_ipv4_host(m["host"]), parse_pasv_port(m["port"]) - elsif m = /\(6,16,(?<host>\d+(,(\d+)){15}),2,(?<port>\d+,\d+)\)/.match(resp) + elsif m = /\(6,16,(?<host>\d+(?:,\d+){15}),2,(?<port>\d+,\d+)\)/.match(resp) return parse_pasv_ipv6_host(m["host"]), parse_pasv_port(m["port"]) else raise FTPProtoError, resp |