sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 4a874da52e44bf8fd9f78c523a344a4fded30eab
parent f99ddf8812e5e73a58fcdb0e86aec3817c4a2b03
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Fri,  5 Oct 2007 21:37:57 +0000

better URI handling for maildir and mbox

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@602 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M lib/sup/maildir.rb | 1 +
M lib/sup/mbox/loader.rb | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
@@ -19,6 +19,7 @@ class Maildir < Source
 
     raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir"
     raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host
+    raise ArgumentError, "mbox URI must have a path component" unless uri.path
 
     @dir = uri.path
     @labels = (labels || []).freeze
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
@@ -16,7 +16,8 @@ class Loader < Source
     when String
       uri = URI(Source.expand_filesystem_uri(uri_or_fp))
       raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
-      raise ArgumentError, "mbox uri ('#{uri}') cannot have a host: #{uri.host}" if uri.host
+      raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" if uri.host
+      raise ArgumentError, "mbox URI must have a path component" unless uri.path
       @f = File.open uri.path
       @path = uri.path
     else