lib/conjur/escape.rb in conjur-api-4.22.1 vs lib/conjur/escape.rb in conjur-api-4.23.0

- old
+ new

@@ -29,17 +29,23 @@ # # @example # fully_escape 'foo/bar@baz' # # => "foo%2Fbar%40baz" # + # @example + # fully_escape 'test/Domain Controllers' + # # => "test%2FDomain%20Controllers" + # # @param [String] str the string to escape # @return [String] the escaped string def fully_escape(str) - require 'cgi' - CGI.escape(str.to_s) + # CGI escape uses + for spaces, which our services don't support :-( + # We just gsub it. + CGI.escape(str.to_s).gsub('+', '%20') end + # Escape a URI path component. # # This method simply calls {Conjur::Escape::ClassMethods#path_or_query_escape}. # # @param [String] str the string to escape @@ -119,6 +125,6 @@ # @see Conjur::Escape::ClassMethods#path_or_query_escape def query_escape(str) self.class.query_escape str end end -end \ No newline at end of file +end