Skip to content

Commit ea40775

Browse files
committed
cell_to_csv for double quote escaping changed all tr to gsub
tr is not escaping double quote characters correctly, replaced with call to gsub.
1 parent e7216e2 commit ea40775

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/roo/base.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,9 @@ def cell_to_csv(row, col, sheet)
663663

664664
case celltype(row, col, sheet)
665665
when :string
666-
%("#{onecell.tr('"', '""')}") unless onecell.empty?
666+
%("#{onecell.gsub('"', '""')}") unless onecell.empty?
667667
when :boolean
668-
%("#{onecell.tr('"', '""').downcase}")
668+
%("#{onecell.gsub('"', '""').downcase}")
669669
when :float, :percentage
670670
if onecell == onecell.to_i
671671
onecell.to_i.to_s
@@ -675,7 +675,7 @@ def cell_to_csv(row, col, sheet)
675675
when :formula
676676
case onecell
677677
when String
678-
%("#{onecell.tr('"', '""')}") unless onecell.empty?
678+
%("#{onecell.gsub('"', '""')}") unless onecell.empty?
679679
when Float
680680
if onecell == onecell.to_i
681681
onecell.to_i.to_s
@@ -692,7 +692,7 @@ def cell_to_csv(row, col, sheet)
692692
when :time
693693
integer_to_timestring(onecell)
694694
when :link
695-
%("#{onecell.url.tr('"', '""')}")
695+
%("#{onecell.url.gsub('"', '""')}")
696696
else
697697
fail "unhandled celltype #{celltype(row, col, sheet)}"
698698
end || ''

0 commit comments

Comments
 (0)