From 643f2ab242ec6b1dfe25cd1d962b1d79343fbf2e Mon Sep 17 00:00:00 2001 From: James Lee Date: Sun, 16 Oct 2011 00:23:29 +0000 Subject: [PATCH] better fix for gsub() on non-String values in the table. Fixes cachedump brokenness git-svn-id: file:///home/svn/framework3/trunk@13944 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/ui/text/table.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/rex/ui/text/table.rb b/lib/rex/ui/text/table.rb index 8ba842a7e9..a593d080cb 100644 --- a/lib/rex/ui/text/table.rb +++ b/lib/rex/ui/text/table.rb @@ -121,11 +121,9 @@ class Table rows.each { |row| next if is_hr(row) str << ( row.map{|x| - if x.nil? - "" - else - x.gsub(/[\r\n]/, ' ').gsub(/\s+/, ' ').gsub('"', '""') - end + x = x.to_s + + x.gsub(/[\r\n]/, ' ').gsub(/\s+/, ' ').gsub('"', '""') }.map{|x| "\"#{x}\"" }.join(",") + "\n" ) } str