mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 03:24:09 +00:00
Escape quotations in CSV imports properly (#1929)
* Parse quotes in imports * Update invalid CSV for test
This commit is contained in:
@@ -29,10 +29,8 @@ class Import::UploadsController < ApplicationController
|
||||
end
|
||||
|
||||
def csv_valid?(str)
|
||||
require "csv"
|
||||
|
||||
begin
|
||||
csv = CSV.parse(str || "", headers: true, col_sep: upload_params[:col_sep])
|
||||
csv = Import.parse_csv_str(str, col_sep: upload_params[:col_sep])
|
||||
return false if csv.headers.empty?
|
||||
return false if csv.count == 0
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user