aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
Commit message (Collapse)AuthorAgeFilesLines
* Raise an ArgumentError instead of a RuntimeErrorGeorge Claghorn2018-07-083-3/+3
|
* Store newly-uploaded files on save rather than assignmentGeorge Claghorn2018-07-0722-679/+1049
|
* Fix that models can clobber each others' attachment reflectionsGeorge Claghorn2018-07-073-16/+25
| | | | | | | | | | | | | | Consider the following model definitions: class User < ApplicationRecord has_one_attached :avatar end class Group < ApplicationRecord has_one_attached :avatar end If you attempt to reflect on the User model's avatar attachment via User.reflect_on_attachment, you could receive a reflection for the Group model's avatar attachment. Fix this by ensuring that each model class uses its own Hash object to track attachment reflections.
* Remove vestigial require on ActiveStorage GCSServiceBibek Shrestha2018-07-041-1/+0
| | | | | | | | | | | | The file `filename.rb` as mentioned in `require "active_storage/filename"` belongs to the `app` folder while GCSService belongs to the lib folder. Looking at the git blame, it was added in commit https://github.com/rails/rails/commit/ccac681122db9747fec9512076772bca345e24b9#diff-bda6a610ef1575b2c8458c96b7f12578 where ActiveStorage::Filename was actually used. But it is no longer required on master and therefore can be removed. This allows anyone to use GCSService directly without enabling ActiveStorage engine.
* Tweak Previewer::PopplerPDFPreviewer#pdftoppm_exists?utilum2018-06-291-1/+1
| | | | Does not warn `instance variable @pdftoppm_exists not initialized`.
* Generate a new key for each service testGeorge Claghorn2018-06-256-20/+20
| | | | Sidestep Google Cloud Storage's restrictive per-object rate limit.
* Update service.rbishanray2018-06-241-1/+1
|
* Permit configuring the default service URL expiryGeorge Claghorn2018-06-218-10/+10
|
* Fix "warning: Net::HTTPResponse#header is obsolete"yuuji.yaginuma2018-06-171-1/+1
| | | | Ref: https://github.com/ruby/ruby/blob/cc77a811298bd7ab1c422f7f999b93c858327da9/lib/net/http/response.rb#L138-L155
* Update ffmpeg -> FFmpeg, mutools|mupdf -> muPDFutilum2018-06-083-5/+5
| | | | [ci skip]
* Refactor activestorage/test/models/attached_test.rbbogdanvlviv2018-06-071-19/+21
| | | | | | | | | | | Don't include `ActiveJob::TestHelper` since there is no test that uses it. Ensure removing of overridden User's methods. Related to https://github.com/rails/rails/pull/33085#issuecomment-395548563 Module#remove_method is private in Ruby 2.4. Related to fd0bd1bf682622f064ac437ceee4e1b2a6b6d3b9
* Exclude upload time from instrumented preview timeGeorge Claghorn2018-06-031-5/+10
|
* Merge pull request #33018 from kddeisz/defined-attachmentsRafael França2018-06-015-0/+119
|\ | | | | ActiveStorage reflection
| * Ensure reflection_class_for is privateKevin Deisz2018-05-311-12/+13
| |
| * Move ActiveStorage reflection logic entirely into ActiveStorageKevin Deisz2018-05-313-2/+74
| |
| * Reflection for attachmentsKevin Deisz2018-05-303-0/+46
| | | | | | | | Add the ability to reflect on the attachments that have been defined using ActiveRecord::Reflection.
* | Remove errant debugger callGeorge Claghorn2018-05-301-1/+0
| |
* | Include blob ID in tempfile name for debugging convenienceGeorge Claghorn2018-05-303-10/+20
|/
* Fix referenceGeorge Claghorn2018-05-281-1/+1
|
* Verify integrity after chunked downloadGeorge Claghorn2018-05-285-3/+24
|
* Hide Active Storage migration installation task (#33007)utilum2018-05-281-0/+3
| | | Resolves #33006
* Merge pull request #32968 from utilum/shadowing_outer_variableGeorge Claghorn2018-05-231-8/+6
|\ | | | | Avoid 2.6 warning: shadowing outer local variable - list
| * Avoid 2.6 warning: shadowing outer local variable - listutilum2018-05-231-8/+6
| |
* | Enable warnings in all test tasksutilum2018-05-231-6/+6
|/ | | | Also normalize AJ task use t, like all other Rails test tasks.
* Change video preview format from PNG to JPGJavan Makhmali2018-05-233-7/+7
|
* Merge pull request #32144 from kazu9su/masterGeorge Claghorn2018-05-221-0/+4
|\ | | | | Add ActiveStorage::Service::DiskService#url_for_direct_upload test
| * Add ActiveStorage::Service::DiskService#url_for_direct_upload testtommy2018-03-011-0/+4
| |
* | Disable variant options when false or nil presentJacob Smith2018-05-213-12/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In response to https://github.com/rails/rails/issues/32917 In the current implementation, ActiveStorage passes all options to the underlying processor, including when a key has a value of false. For example, passing: ``` avatar.variant(resize: "100x100", monochrome: false, flip: "-90") ``` will return a monochrome image (or an error, pending on ImageMagick configuration) because it passes `-monochrome false` to the command (but the command line does not allow disabling flags this way, as usually a user would omit the flag entirely to disable that feature). This fix only passes those keys forward to the underlying processor if the value responds to `present?`. In practice, this means that `false` or `nil` will be filtered out before going to the processor. One possible use case would be for a user to be able to apply different filters to an avatar. The code might look something like: ``` variant_options = { monochrome: params[:monochrome], resize: params[:resize] } avatar.variant(*variant_options) ``` Obviously some sanitization may be beneficial in a real-world scenario, but this type of configuration object could be used in many other places as well. - Add removing falsy values from varaints to changelog - The entirety of #image_processing_transformation inject block was wrapped in `list.tap` to guard against the default `nil` being returned if no conditional was called. - add test for explicitly true variant options
* | Permit opening a blob in a custom tempdirGeorge Claghorn2018-05-175-9/+26
| |
* | Generate getter and setter methods in mixinJosh Susser2018-05-173-2/+62
| | | | | | | | | | | | | | | | | | | | | | Generated attachment getter and setter methods are created within the model's `GeneratedAssociationMethods` module to allow overriding and composition using `super`. Includes tests for new functionality. Co-authored-by: Josh Susser <josh@hasmanythrough.com> Co-authored-by: Jamon Douglas <terrildouglas@gmail.com>
* | Fix formatting of author credit [ci skip]Ryuta Kamizono2018-05-171-1/+1
| |
* | Active storage: Image variant options not correctlucfranken2018-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Steps to reproduce Using Rails 5.2.0 When following this example: http://api.rubyonrails.org/classes/ActiveStorage/Variant.html `avatar.variant(resize: "100x100", monochrome: true, flip: "-90")` ### Expected behavior Image should be rendered as flipped. ### Actual behavior I get an error: > failed with error: gm mogrify: Unrecognized option (-90). ### Fix: According to: https://github.com/minimagick/minimagick the option should be called rotate: `avatar.variant(resize: "100x100", monochrome: true, rotate: "-90")` So **flip** changed to **rotate**. ### System configuration **Rails version**: 5.2.0 **Ruby version**: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
* | Remove unused `require "active_support/core_ext/string/filters"`Ryuta Kamizono2018-05-171-2/+0
| |
* | Add ActiveStorage::Previewer#tempdirGeorge Claghorn2018-05-161-1/+5
| |
* | Add missing block parametersGeorge Claghorn2018-05-162-2/+2
| |
* | Add ActiveStorage::Blob#openGeorge Claghorn2018-05-168-12/+81
| | | | | | | | [David Robertson & George Claghorn]
* | Add option to ActiveStorage::Blob to set extract_content_type_from_ioRyan Davidson2018-05-084-9/+37
| | | | | | | | | | | | | | This adds a boolean argument called identify to ActiveStorage::Blob methods #create_after_upload, #build_after_upload and #upload. It allows a user to bypass the automatic content_type inference from the io.
* | Assert correct response bodyGeorge Claghorn2018-05-031-4/+6
| |
* | Stream blobs from diskGeorge Claghorn2018-05-021-2/+13
| |
* | Support streaming downloads from Google Cloud StorageGeorge Claghorn2018-05-013-24/+43
| |
* | Avoid duplicating downloads from Google Cloud Storage in memoryGeorge Claghorn2018-04-291-2/+2
| | | | | | | | References #32703.
* | Stream blobs from disk in 5 MB chunksGeorge Claghorn2018-04-292-4/+4
| | | | | | | | Match other services, which all use a 5 MB chunk size.
* | Merge pull request #31956 from fatkodima/has_attached-presence-validationEileen M. Uchitelle2018-04-272-0/+34
|\ \ | | | | | | has_(one/many)_attached presence validation
| * | has_(one/many)_attached presence validationfatkodima2018-02-112-0/+34
| | |
* | | Move #extract_metadata_from to ActiveStorage's TestHelperRicardo Díaz2018-04-253-10/+4
| | | | | | | | | | | | | | | | | | ImageAnalyzerTest and VideoAnalyzerTest are defining the same helper, since both use `#create_file_blob` that is defined in TestHelper, it makes sense to move `#extract_metadata_from` to that side.
* | | Simplify URL generation for partial downloads from GCSGeorge Claghorn2018-04-251-1/+2
| | |
* | | Unminify activestorage.jsJavan Makhmali2018-04-256-1386/+1093
| | |
* | | Flush tempfile after populating itGeorge Claghorn2018-04-231-0/+1
| | | | | | | | | | | | Ensure that other processes like ImageMagick and FFmpeg see the complete contents of the file.
* | | Merge pull request #32471 from janko-m/use-image_processing-gemGeorge Claghorn2018-04-2310-74/+171
|\ \ \ | | | | | | | | Use ImageProcessing gem for ActiveStorage variants
| * | | Don't swallow LoadError raised for missing libvipsJanko Marohnić2018-04-231-3/+7
| | | |