From a2386b168c8078317ba58504de3ad1ac41f97917 Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Sun, 30 Aug 2026 15:34:27 +0700 Subject: [PATCH] Repair legacy FTP.new2 construction --- lib/uri/ftp.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index 1c75e24..789d4b9 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -49,7 +49,7 @@ def self.new2(user, password, host, port, path, # Do not use this method! Not tested. [Bug #7301] # This methods remains just for compatibility, # Keep it undocumented until the active maintainer is assigned. - typecode = nil if typecode.size == 0 + typecode = nil if typecode&.empty? if typecode && !TYPECODE.include?(typecode) raise ArgumentError, "bad typecode is specified: #{typecode}" @@ -57,8 +57,10 @@ def self.new2(user, password, host, port, path, # do escape + userinfo = password.nil? ? user : "#{user}:#{password}" + self.new('ftp', - [user, password], + userinfo, host, port, nil, typecode ? path + TYPECODE_PREFIX + typecode : path, nil, nil, nil, arg_check)