mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cgi/util.rb (CGI::pretty): fix the overflow bug
if stripped string.[ruby-dev:37975] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f97d8eec10
commit
5de99652bd
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Nov 13 00:46:24 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/cgi/util.rb (CGI::pretty): fix the overflow bug
|
||||||
|
if stripped string.[ruby-dev:37975]
|
||||||
|
|
||||||
Thu Nov 12 23:08:11 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
|
Thu Nov 12 23:08:11 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
|
||||||
|
|
||||||
* lib/cgi/core.rb (read_from_cmdline): this code is better.
|
* lib/cgi/core.rb (read_from_cmdline): this code is better.
|
||||||
|
|
|
@ -170,7 +170,7 @@ class CGI
|
||||||
# # </HTML>
|
# # </HTML>
|
||||||
#
|
#
|
||||||
def CGI::pretty(string, shift = " ")
|
def CGI::pretty(string, shift = " ")
|
||||||
lines = string.gsub(/(?!\A)<(?:.|\n)*?>/, "\n\\0").gsub(/<(?:.|\n)*?>(?!\n)/, "\\0\n")
|
lines = string.gsub(/(?!\A)<.*?>/m, "\n\\0").gsub(/<.*?>(?!\n)/m, "\\0\n")
|
||||||
end_pos = 0
|
end_pos = 0
|
||||||
while end_pos = lines.index(/^<\/(\w+)/, end_pos)
|
while end_pos = lines.index(/^<\/(\w+)/, end_pos)
|
||||||
element = $1.dup
|
element = $1.dup
|
||||||
|
|
Loading…
Reference in a new issue