Skip substitution if badchars is empty

bug/bundler_fix
HD Moore 2015-09-02 18:52:53 -05:00
parent 01cbd842ad
commit 9f1f797031
1 changed files with 1 additions and 0 deletions

View File

@ -1522,6 +1522,7 @@ module Text
# @param data [#delete]
# @param badchars [String] A list of characters considered to be bad
def self.remove_badchars(data, badchars = '')
return data if badchars.length == 0
badchars_pat = badchars.unpack("C*").map{|c| "\\x%.2x" % c}.join
data.gsub!(/[#{badchars_pat}]/n, '')
data