Skip to content

Commit

Permalink
Merge pull request #166 from sharetribe/fix-csv-export
Browse files Browse the repository at this point in the history
Fix CSV exports
  • Loading branch information
bladealslayer committed Jun 7, 2022
2 parents 3330c0f + bcf65d8 commit ab2daa6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/initializers/paperclip.rb
Expand Up @@ -2,6 +2,14 @@
Paperclip::DataUriAdapter.register
Paperclip::HttpUrlProxyAdapter.register

# Paperclip (via the OS file util) discovers CSV as application/csv, which
# conflicts with the default MIME type text/csv. We override the default to
# prevent Paperclip from considering this a content type spoof. The CSV files
# are generated by us, so should be safe.
Paperclip.options[:content_type_mappings] = {
csv: %w(application/csv)
}

module Paperclip
Attachment.class_eval do
def assign(uploaded_file)
Expand Down

0 comments on commit ab2daa6

Please sign in to comment.