Fixed usage of lst[] in web form, now we are url-decoding the name because the [] could escaped...
Fixed bad code for assertion related to variable url-encoded name
This commit is contained in:
@@ -161,7 +161,7 @@ feature -- String query
|
|||||||
i := 0 -- Exit
|
i := 0 -- Exit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Result.keep_head (n)
|
Result.keep_head (n - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
string_query_parameter (a_name: READABLE_STRING_8): detachable READABLE_STRING_32
|
string_query_parameter (a_name: READABLE_STRING_8): detachable READABLE_STRING_32
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ feature -- Element change
|
|||||||
|
|
||||||
add_value (a_value: WSF_VALUE; k: READABLE_STRING_32)
|
add_value (a_value: WSF_VALUE; k: READABLE_STRING_32)
|
||||||
require
|
require
|
||||||
same_name: a_value.name.same_string (name)
|
same_name: a_value.name.same_string (name) or else (a_value.name.starts_with (name) and then a_value.name.item (name.count + 1) = '[')
|
||||||
do
|
do
|
||||||
values.force (a_value, k)
|
values.force (a_value, k)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,20 +43,21 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
add_value_to_table (a_name: READABLE_STRING_8; a_value: READABLE_STRING_8; a_table: HASH_TABLE [WSF_VALUE, READABLE_STRING_32])
|
add_value_to_table (a_name: READABLE_STRING_8; a_value: READABLE_STRING_8; a_table: HASH_TABLE [WSF_VALUE, READABLE_STRING_32])
|
||||||
local
|
local
|
||||||
|
l_decoded_name: STRING_32
|
||||||
v: detachable WSF_VALUE
|
v: detachable WSF_VALUE
|
||||||
n,k,r: STRING_8
|
n,k,r: STRING_32
|
||||||
k32: STRING_32
|
-- k32: STRING_32
|
||||||
p,q: INTEGER
|
p,q: INTEGER
|
||||||
tb,ptb: detachable WSF_TABLE
|
tb,ptb: detachable WSF_TABLE
|
||||||
do
|
do
|
||||||
--| Check if this is a list format such as choice[] or choice[a] or even choice[a][] or choice[a][b][c]...
|
--| Check if this is a list format such as choice[] or choice[a] or even choice[a][] or choice[a][b][c]...
|
||||||
p := a_name.index_of ('[', 1)
|
l_decoded_name := url_encoder.decoded_string (a_name)
|
||||||
|
p := l_decoded_name.index_of ({CHARACTER_32}'[', 1)
|
||||||
if p > 0 then
|
if p > 0 then
|
||||||
q := a_name.index_of (']', p + 1)
|
q := l_decoded_name.index_of ({CHARACTER_32}']', p + 1)
|
||||||
if q > p then
|
if q > p then
|
||||||
n := a_name.substring (1, p - 1)
|
n := l_decoded_name.substring (1, p - 1)
|
||||||
r := a_name.substring (q + 1, a_name.count)
|
r := l_decoded_name.substring (q + 1, l_decoded_name.count)
|
||||||
r.left_adjust; r.right_adjust
|
r.left_adjust; r.right_adjust
|
||||||
|
|
||||||
create tb.make (n)
|
create tb.make (n)
|
||||||
@@ -64,31 +65,31 @@ feature {NONE} -- Implementation
|
|||||||
tb := l_existing_table
|
tb := l_existing_table
|
||||||
end
|
end
|
||||||
|
|
||||||
k := a_name.substring (p + 1, q - 1)
|
k := l_decoded_name.substring (p + 1, q - 1)
|
||||||
k.left_adjust; k.right_adjust
|
k.left_adjust; k.right_adjust
|
||||||
if k.is_empty then
|
if k.is_empty then
|
||||||
k.append_integer (tb.count + 1)
|
k.append_integer (tb.count + 1)
|
||||||
end
|
end
|
||||||
v := tb
|
v := tb
|
||||||
n.append_character ('[')
|
n.append_character ({CHARACTER_32}'[')
|
||||||
n.append (k)
|
n.append (k)
|
||||||
n.append_character (']')
|
n.append_character ({CHARACTER_32}']')
|
||||||
|
|
||||||
from
|
from
|
||||||
until
|
until
|
||||||
r.is_empty
|
r.is_empty
|
||||||
loop
|
loop
|
||||||
ptb := tb
|
ptb := tb
|
||||||
p := r.index_of ({CHARACTER_8} '[', 1)
|
p := r.index_of ({CHARACTER_32} '[', 1)
|
||||||
if p > 0 then
|
if p > 0 then
|
||||||
q := r.index_of ({CHARACTER_8} ']', p + 1)
|
q := r.index_of ({CHARACTER_32} ']', p + 1)
|
||||||
if q > p then
|
if q > p then
|
||||||
k32 := url_encoder.decoded_string (k)
|
-- k32 := url_encoder.decoded_string (k)
|
||||||
if attached {WSF_TABLE} ptb.value (k32) as l_tb_value then
|
if attached {WSF_TABLE} ptb.value (k) as l_tb_value then
|
||||||
tb := l_tb_value
|
tb := l_tb_value
|
||||||
else
|
else
|
||||||
create tb.make (n)
|
create tb.make (n)
|
||||||
ptb.add_value (tb, k32)
|
ptb.add_value (tb, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
k := r.substring (p + 1, q - 1)
|
k := r.substring (p + 1, q - 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user