Skip to content

Commit

Permalink
"keep the entity size within the limitation"
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Oct 28, 2014
1 parent 575b395 commit b8e1016
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ruby/1.8/rexml/entity.rb
Expand Up @@ -138,8 +138,14 @@ def value
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
if sum + entity_value.bytesize > Document.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += entity_value.bytesize
end
rv.gsub!( /%#{entity_reference};/um, entity_value )
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/ruby/1.9/rexml/entity.rb
Expand Up @@ -138,8 +138,14 @@ def value
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
if sum + entity_value.bytesize > Document.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += entity_value.bytesize
end
rv.gsub!( /%#{entity_reference.join};/um, entity_value )
end
end
Expand Down
6 changes: 6 additions & 0 deletions lib/ruby/2.0/rexml/entity.rb
Expand Up @@ -138,8 +138,14 @@ def value
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
if sum + entity_value.bytesize > Document.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += entity_value.bytesize
end
rv.gsub!( /%#{entity_reference.join};/um, entity_value )
end
end
Expand Down

0 comments on commit b8e1016

Please sign in to comment.