]> git.cworth.org Git - sup/commitdiff
better URI handling for maildir and mbox
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Fri, 5 Oct 2007 21:37:57 +0000 (21:37 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Fri, 5 Oct 2007 21:37:57 +0000 (21:37 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@602 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/maildir.rb
lib/sup/mbox/loader.rb

index bb59c73211854c5ac04d3dd9d3254ca30f0acd48..6020c8629c22b82d0637c8ffe494bbd88cd4a461 100644 (file)
@@ -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
index c1392654e17aa7e00fe471efa2c978e41458d46b..48ddfba41a91b00622fccece63064f8ccd0fd85b 100644 (file)
@@ -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