Feature #255

CGI element generation methods should convert keys/values to Strings before escaping.

Added by Anonymous almost 4 years ago. Updated about 1 year ago.

[ruby-core:17724]
Status:Closed Start date:07/10/2008
Priority:Normal Due date:
Assignee:xibbar (Takeyuki Fujioka) % Done:

0%

Category:-
Target version:1.9.1 Release Candidate

Description

@cgi.file_field("test", 40)
  # => '<INPUT SIZE="40" NAME="test" TYPE="file">'

  @cgi.file_field("NAME" => "test", "SIZE" => 40)
  # => private method `gsub' called for 40:Fixnum

The attached patch fixes this issue for all element generation methods.
Additionally, it allows passing Symbols instead of Strings for attribute names.

  @cgi.file_field("NAME" => "test", "SIZE" => 40)
  # => '<INPUT SIZE="40" NAME="test" TYPE="file">'

  @cgi.file_field(:NAME => "test", :SIZE => 40)
  # => '<INPUT SIZE="40" NAME="test" TYPE="file">'

cgi_elements.patch (604 Bytes) Anonymous, 07/10/2008 10:10 pm

new_cgi_elements.patch - New patch (395 Bytes) NoKarma (Arthur Schreiber), 07/18/2008 06:33 pm

History

Updated by NoKarma (Arthur Schreiber) almost 4 years ago

Just wanted to say that this report and the patch are by me.

Updated by NoKarma (Arthur Schreiber) almost 4 years ago

Ok, the old patch is bugged.
Converting keys to Strings using #to_s might result in duplicated element attributes, so this change has been removed.

New patch attached.

Updated by naruse (Yui NARUSE) over 3 years ago

  • Assignee set to xibbar (Takeyuki Fujioka)

Updated by yugui (Yuki Sonoda) over 3 years ago

  • Target version set to 1.9.1 Release Candidate

Updated by xibbar (Takeyuki Fujioka) over 3 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF