Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease Memory footprint #1652

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/carrierwave/processing/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module MimeTypes
included do
CarrierWave::Utilities::Deprecation.new "0.11.0", "CarrierWave::MimeTypes is deprecated and will be removed in the future, get the content_type from the SanitizedFile object directly."
begin
# Use mime/types/columnar if available, for reduced memory usage
require 'mime/types/columnar'
rescue LoadError
require "mime/types"
rescue LoadError => e
e.message << " (You may need to install the mime-types gem)"
Expand Down
8 changes: 7 additions & 1 deletion lib/carrierwave/sanitized_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

require 'pathname'
require 'active_support/core_ext/string/multibyte'
require 'mime/types'

begin
# Use mime/types/columnar if available, for reduced memory usage
require 'mime/types/columnar'
rescue LoadError
require 'mime/types'
end

module CarrierWave

Expand Down
8 changes: 7 additions & 1 deletion spec/sanitized_file_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# encoding: utf-8

require 'spec_helper'
require 'mime/types'

begin
# Use mime/types/columnar if available, for reduced memory usage
require 'mime/types/columnar'
rescue LoadError
require 'mime/types'
end

describe CarrierWave::SanitizedFile do

Expand Down