lib/sup/mbox.rb in sup-1.0 vs lib/sup/mbox.rb in sup-1.1
- old
+ new
@@ -17,27 +17,27 @@
@labels = Set.new((labels || []) - LabelManager::RESERVED_LABELS)
case uri_or_fp
when String
@expanded_uri = Source.expand_filesystem_uri(uri_or_fp)
- 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 @expanded_uri)
@path = uri.path
end
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 must have a path component" unless uri.path
@f = nil
else
@f = uri_or_fp
@path = uri_or_fp.path
- @expanded_uri = "mbox://#{URI.encode @path, URI_ENCODE_CHARS}"
+ @expanded_uri = "mbox://#{Source.encode_path_for_uri @path}"
end
super uri_or_fp, usual, archived, id
end