[Groonga-commit] groonga/groonga-command-parser at 1c0823e [master] Fix a bug that parameter name in URL isn't unescaped

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jul 9 21:58:17 JST 2015


Kouhei Sutou	2015-07-09 21:58:17 +0900 (Thu, 09 Jul 2015)

  New Revision: 1c0823ed99a62b491e71e2b17e0a5713c75dbc68
  https://github.com/groonga/groonga-command-parser/commit/1c0823ed99a62b491e71e2b17e0a5713c75dbc68

  Message:
    Fix a bug that parameter name in URL isn't unescaped

  Modified files:
    lib/groonga/command/parser.rb
    test/test-parser.rb

  Modified: lib/groonga/command/parser.rb (+1 -1)
===================================================================
--- lib/groonga/command/parser.rb    2015-07-09 21:55:57 +0900 (757e18a)
+++ lib/groonga/command/parser.rb    2015-07-09 21:58:17 +0900 (91828c0)
@@ -282,7 +282,7 @@ module Groonga
           arguments_string.split(/&/).each do |argument_string|
             key, value = argument_string.split(/\=/, 2)
             next if value.nil?
-            arguments[key] = CGI.unescape(value)
+            arguments[CGI.unescape(key)] = CGI.unescape(value)
           end
         end
         if /\/([^\/]*)\z/=~ path

  Modified: test/test-parser.rb (+10 -0)
===================================================================
--- test/test-parser.rb    2015-07-09 21:55:57 +0900 (79bc64a)
+++ test/test-parser.rb    2015-07-09 21:58:17 +0900 (add2fe6)
@@ -59,6 +59,16 @@ class ParserTest < Test::Unit::TestCase
                    command.arguments)
     end
 
+    def test_escaped_bracket
+      path = "/d/select?table=Users&drilldown%5Bname%5D.keys=name"
+      command = Groonga::Command::Parser.parse(path)
+      assert_equal({
+                     :table => "Users",
+                     :"drilldown[name].keys" => "name",
+                   },
+                   command.arguments)
+    end
+
     def test_custom_prefix
       path = "/db1/select?table=Users"
       command = Groonga::Command::Parser.parse(path)
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index