1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00

Escape quotations in CSV imports properly (#1929)

* Parse quotes in imports

* Update invalid CSV for test
This commit is contained in:
Zach Gollwitzer 2025-02-28 12:21:07 -05:00 committed by GitHub
parent 7c66f16750
commit 4d0df9b950
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 12 deletions

View file

@ -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