From 26704b1d9409f6d1e3efc1819c1540579760b3af Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 8 Aug 2018 12:23:28 -0500 Subject: [PATCH] Fix where text/csv exports weren't always uploaded as attachment --- lib/export/export_payments.rb | 2 +- lib/export/export_recurring_donations.rb | 2 +- spec/lib/export/export_payments_spec.rb | 1 + spec/lib/export/export_recurring_donations_spec.rb | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/export/export_payments.rb b/lib/export/export_payments.rb index b5d317aa..a54d5dc1 100644 --- a/lib/export/export_payments.rb +++ b/lib/export/export_payments.rb @@ -53,7 +53,7 @@ module ExportPayments file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S') filename = "tmp/csv-exports/payments-#{file_date}.csv" - url = CHUNKED_UPLOADER.upload(filename, QueryPayments.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv') + url = CHUNKED_UPLOADER.upload(filename, QueryPayments.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv', content_disposition: 'attachment') export.url = url export.status = :completed export.ended = Time.now diff --git a/lib/export/export_recurring_donations.rb b/lib/export/export_recurring_donations.rb index 3fbb3382..a8b146e5 100644 --- a/lib/export/export_recurring_donations.rb +++ b/lib/export/export_recurring_donations.rb @@ -53,7 +53,7 @@ module ExportRecurringDonations file_date = Time.now.getutc().strftime('%m-%d-%Y--%H-%M-%S') filename = "tmp/csv-exports/recurring_donations-#{file_date}.csv" - url = CHUNKED_UPLOADER.upload(filename, QueryRecurringDonations.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv') + url = CHUNKED_UPLOADER.upload(filename, QueryRecurringDonations.for_export_enumerable(npo_id, params, 30000).map{|i| i.to_csv}, :content_type => 'text/csv', content_disposition: 'attachment') export.url = url export.status = :completed export.ended = Time.now diff --git a/spec/lib/export/export_payments_spec.rb b/spec/lib/export/export_payments_spec.rb index 53d9a872..f58fd814 100644 --- a/spec/lib/export/export_payments_spec.rb +++ b/spec/lib/export/export_payments_spec.rb @@ -192,6 +192,7 @@ describe ExportPayments do expect(csv[0]).to eq MockHelpers.payment_export_headers expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv' + expect(TestChunkedUploader.options[:content_disposition]).to eq 'attachment' expect(user).to have_received_email(subject: "Your payment export is available!") end end diff --git a/spec/lib/export/export_recurring_donations_spec.rb b/spec/lib/export/export_recurring_donations_spec.rb index 5f6d8682..34065a92 100644 --- a/spec/lib/export/export_recurring_donations_spec.rb +++ b/spec/lib/export/export_recurring_donations_spec.rb @@ -194,6 +194,7 @@ describe ExportRecurringDonations do expect(csv[0]).to eq MockHelpers.recurring_donation_export_headers expect(TestChunkedUploader.options[:content_type]).to eq 'text/csv' + expect(TestChunkedUploader.options[:content_disposition]).to eq 'attachment' expect(@user).to have_received_email(subject: "Your recurring donations export is available!") end end