From 7924438a9c0fc2963a2f53db1688a7c1571bf952 Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Sun, 30 Aug 2026 15:34:33 +0700 Subject: [PATCH] Preserve FTP query and fragment in destructive merges --- lib/uri/ftp.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index 1c75e24..ee6bee1 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -220,6 +220,16 @@ def merge(oth) # :nodoc: return tmp end + def merge!(oth) # :nodoc: + tmp = merge(oth) + return if self == tmp && query == tmp.query && fragment == tmp.fragment + + replace!(tmp) + self.query = tmp.query + self.fragment = tmp.fragment + self + end + # Returns the path from an FTP URI. # # RFC 1738 specifically states that the path for an FTP URI does not