sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit b5213d223214eded99d38a97027503f1d6c39b98
parent 437c61b81f32fe0d2a0f4bda0ca35d49b745a725
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sun, 17 Apr 2022 16:25:45 +1000

sup-add: avoid URI.escape

This method was also removed in Ruby 3.0.

We can't use the new Source.encode_path_for_uri helper method here,
because sup-add expects a complete URI, not just a path. That method
will wrongly escape the colon in the URI scheme.

The simplest fix is to just remove the URI encoding and parsing here
entirely, and leave that until later when sup loads the sources.

Fixes #588.

Diffstat:
M bin/sup-add | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/bin/sup-add b/bin/sup-add
@@ -94,18 +94,14 @@ begin
       next
     end
 
-    parsed_uri = URI(URI.escape(uri))
-
     source =
-      case parsed_uri.scheme
-      when "maildir"
+      case uri
+      when /^maildir:/
         Redwood::Maildir.new uri, !$opts[:unusual], $opts[:archive], $opts[:sync_back], nil, labels
-      when "mbox"
+      when /^mbox:/
         Redwood::MBox.new uri, !$opts[:unusual], $opts[:archive], nil, labels
       when nil
-        Optimist::die "Sources must be specified with an URI"
-      else
-        Optimist::die "Unknown source type #{parsed_uri.scheme.inspect}"
+        Optimist::die "Sources must be specified with a maildir:// or mbox:// URI"
       end
     @cli.say "Adding #{source}..."
     Redwood::SourceManager.add_source source