aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorXu Cheng2016-03-14 19:48:16 +0800
committerXu Cheng2016-03-14 19:58:15 +0800
commita6b918d6c5cd8a05494002d288f15d9b7b30f9df (patch)
treea02f48ec11cecf57750e5d2882012d26cfb28463 /Library/Homebrew
parenta74e872409d0c8a16ff806a52e76adcefcf2c4da (diff)
downloadbrew-a6b918d6c5cd8a05494002d288f15d9b7b30f9df.tar.bz2
test-bot: better xml character filtering
Ref: - http://www.w3.org/TR/xml/#charsets - http://stackoverflow.com/a/14323524 Closes Homebrew/homebrew#50092. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/test-bot.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb
index 38779531d..6706c1b29 100644
--- a/Library/Homebrew/cmd/test-bot.rb
+++ b/Library/Homebrew/cmd/test-bot.rb
@@ -917,8 +917,9 @@ module Homebrew
testcase.add_attribute "time", step.time
if step.has_output?
- # Remove invalid XML CData characters from step output.
- output = step.output.delete("\000\a\b\e\f\x2\x1f")
+ # Remove invalid XML characters
+ # http://www.w3.org/TR/xml/#charsets
+ output = step.output.gsub(/[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]/, "")
if output.bytesize > BYTES_IN_1_MEGABYTE
output = "truncated output to 1MB:\n" \