lib/sup/maildir.rb in sup-1.0 vs lib/sup/maildir.rb in sup-1.1

- old
+ new

@@ -10,17 +10,17 @@ ## remind me never to use inheritance again. yaml_properties :uri, :usual, :archived, :sync_back, :id, :labels def initialize uri, usual=true, archived=false, sync_back=true, id=nil, labels=[] super uri, usual, archived, id @expanded_uri = Source.expand_filesystem_uri(uri) - parts = @expanded_uri.match /^([a-zA-Z0-9]*:(\/\/)?)(.*)/ + parts = /^([a-zA-Z0-9]*:(\/\/)?)(.*)/.match @expanded_uri if parts prefix = parts[1] @path = parts[3] - uri = URI(prefix + URI.encode(@path, URI_ENCODE_CHARS)) + uri = URI(prefix + Source.encode_path_for_uri(@path)) else - uri = URI(URI.encode @expanded_uri, URI_ENCODE_CHARS) + uri = URI(Source.encode_path_for_uri @path) @path = uri.path end raise ArgumentError, "not a maildir URI" unless uri.scheme == "maildir" raise ArgumentError, "maildir URI cannot have a host: #{uri.host}" if uri.host @@ -28,10 +28,10 @@ @sync_back = sync_back # sync by default if not specified @sync_back = true if @sync_back.nil? - @dir = URI.decode uri.path + @dir = URI.decode_www_form_component uri.path @labels = Set.new(labels || []) @mutex = Mutex.new @ctimes = { 'cur' => Time.at(0), 'new' => Time.at(0) } end