diff options
Diffstat (limited to 'lib/chef_zero/rest_base.rb')
-rw-r--r-- | lib/chef_zero/rest_base.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef_zero/rest_base.rb b/lib/chef_zero/rest_base.rb index 89c2b12..be50de2 100644 --- a/lib/chef_zero/rest_base.rb +++ b/lib/chef_zero/rest_base.rb @@ -77,7 +77,7 @@ module ChefZero def get_data(request, rest_path = nil, *options) rest_path ||= request.rest_path - rest_path = rest_path.map { |v| URI.decode(v) } + rest_path = rest_path.map { |v| self.class.rfc2396_parser.unescape(v) } begin data_store.get(rest_path, request) rescue DataStore::DataNotFoundError @@ -284,7 +284,7 @@ module ChefZero end def self.build_uri(base_uri, rest_path) - "#{base_uri}/#{rest_path.map { |v| URI.escape(v) }.join("/")}" + "#{base_uri}/#{rest_path.map { |v| rfc2396_parser.escape(v) }.join("/")}" end def populate_defaults(request, response) @@ -324,5 +324,9 @@ module ChefZero name.size > 255 || name =~ /[+ !]/ end + + def self.rfc2396_parser + @parser ||= URI::RFC2396_Parser.new + end end end |