From 88a1fa54f9ea8072c3207cdcf73d02611621a81b Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Sun, 30 Aug 2026 15:34:30 +0700 Subject: [PATCH] Handle string FTP merges --- lib/uri/ftp.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index 1c75e24..b92bcc3 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -212,9 +212,11 @@ def typecode=(typecode) end def merge(oth) # :nodoc: - tmp = super(oth) - if self != tmp - tmp.set_typecode(oth.typecode) + rel = parser.__send__(:convert_to_uri, oth) + tmp = super(rel) + if tmp.is_a?(FTP) && self != tmp + tmp.set_typecode(rel.is_a?(FTP) ? rel.typecode : nil) + tmp = parser.parse(tmp.to_s) unless rel.is_a?(FTP) end return tmp