aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | |
| * | Add CHANGELOG entryJanko Marohnić2018-04-231-0/+19
| | |
| * | Recommend using :resize_to_fit after allJanko Marohnić2018-04-235-13/+13
| | |
| * | Remove warning that image will be loaded into memoryJanko Marohnić2018-04-231-4/+4
| | | | | | | | | | | | | | | This is not true anymore, the image will be downloaded into a temporary file in a streaming fashion.
| * | Show ImageProcessing macros in a dedicated exampleJanko Marohnić2018-04-232-16/+25
| | |
| * | Ensure result file is deleted on uploading errorsJanko Marohnić2018-04-221-4/+10
| | |
| * | Rename ActiveStorage.processor to .variant_processorJanko Marohnić2018-04-225-15/+15
| | |
| * | Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-187-66/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend.
* | | Halve memory allocation in S3Service#downloadJanko Marohnić2018-04-231-1/+1
|/ / | | | | | | | | | | | | | | Aws::S3::Object#get returns a response with object content wrapped in an in-memory StringIO object. StringIO#read will return a copy of the content, which is not necessary because we can return the content directly using StringIO#string. This halves memory allocation of S3Service#download, because we remove unnecessary content duplication.
* | Always exclude JSON root from direct_uploads#create responseJavan Makhmali2018-04-102-1/+24
| | | | | | | | | | | | The JavaScript component expects a bare response. Fixes #32365
* | Merge pull request #32494 from dixpac/as_fix_outdated_documentation_for_variantsRyuta Kamizono2018-04-082-4/+4
|\ \ | | | | | | Fix leftover references to VariantsController in AS documentation [ci skip]
| * | Fix leftover references to VariantsController [ci skip]dixpac2018-04-082-4/+4
| | | | | | | | | | | | | | | VariantsController has been merged to RepresentationsController, this PR fixes outdated references to VariantsController in ActiveStorage documentation.
* | | Enable verbose option in ActiveStorageYoshiyuki Hirano2018-04-081-0/+1
|/ /
* | Use a current model to provide the host for service urlsAndrew White2018-04-066-6/+26
| | | | | | | | | | | | | | Trying to pass the current request down to the service so that it can create full urls instead of paths makes the API messy so use a model based on ActiveSupport::CurrentAttributes to provide the current host to services that need it (primarily the disk service).
* | Protect all active storage controllers agains CSRFRafael Mendonça França2018-04-065-5/+11
| | | | | | | | | | Before it was possible to for example use the direct upload controller without using the site.
* | fixes a bug in IE11 that broke direct uploadskylekeesling2018-04-062-2/+2
| |
* | Flip the order of the after_create callbacksDwight Watson2018-03-273-4/+24
| | | | | | | | | | | | | | | | | | | | Addresses rails/rails#32247 Add test that checks identify and analyze work in correct order Break out direct upload test helper Review changes for direct-upload test helper
* | Remove backported CHANGELOG entry [ci skip]Andrew White2018-03-191-8/+0
| |
* | Allow full use of the AWS S3 SDK authentication options (#32270)Brian Knight2018-03-193-3/+11
| | | | | | | | | | | | | | | | | | If an explicit AWS key pair and/or region is not provided in config/storage.yml, attempt to use environment variables, shared credentials, or IAM role credentials. Order of precedence is determined by the AWS SDK[1]. [1]: https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html
* | Remove changelog header for unreleased versionRafael Mendonça França2018-03-131-2/+0
| | | | | | | | | | | | We only add the header when releasing to avoid some conflicts. [ci skip]
* | Fix Azure signed URL generation with newer client libGeorge Claghorn2018-03-121-6/+4
| |
* | Update ASt test services configGeorge Claghorn2018-03-121-0/+0
| |
* | Remove path config option from Azure serviceAndrew White2018-03-122-7/+10
| | | | | | | | | | | | | | | | | | | | | | The Active Storage service for Azure Storage has an option called `path` that is ambiguous in meaning. It needs to be set to the primary blob storage endpoint but that can be determined from the blobs client anyway. To simplify the configuration this commit removes the `path` option and gets the endpoint from the blobs client instead. Closes #32225.
* | Provide an alternative PDF previewer based on PopplerTerence Lee2018-03-067-35/+103
| | | | | | | | | | | | mutool is licensed under the Affero GPL, which has strict distribution requirements. Poppler is licensed under the more liberal GPL, making it a good alternative for those who can't use mutool.
* | Update test to reflect GCS direct upload header changeGeorge Claghorn2018-03-061-1/+1
| |
* | Allow selectively purging attached blobsNicholas Shirley2018-03-063-12/+46
| |
* | Remove blank Content-Type from GCS direct upload headersGeorge Claghorn2018-03-061-1/+1
| | | | | | | | Since we started clearing the client-side blob's type in e0867b3, we no longer need to set a blank Content-Type header before issuing the direct upload request. Fixes that Safari 9 would combine the blank Content-Type header with the blank blob type to produce a Content-Type header containing a single comma, invalidating the request.
* | Fix purging dependent blobs when attachments aren't loadedGeorge Claghorn2018-03-054-25/+35
| |
* | Delete dependent attachments with recordGeorge Claghorn2018-03-053-2/+17
| | | | | | | | [Matt Jones & George Claghorn]
* | Correct the ActiveStorage::Service#download_chunk docs [ci skip]George Claghorn2018-03-051-1/+1
| |
* | Generate root-relative paths in Active Storage disk service URL methodsGeorge Claghorn2018-03-0514-55/+66
| | | | | | | | Fixes #32129.
* | Handle another case where a blob might be erroneously purgedGeorge Claghorn2018-03-042-5/+22
| |
* | Avoid purging attached blob when replacing it with itselfGeorge Claghorn2018-03-042-2/+18
| |
* | Merge Previews/Variants controller into one Representations controller.Kasper Timm Hansen2018-03-037-100/+74
| | | | | | | | | | | | | | | | | | Since ActiveStorage::Blob::Representable unifies the idea of previews and variants under one roof as representation, we may as well have the controllers follow suit. Thus ActiveStorage::RepresenationsController enters the fray. I've copied the old tests for both previews and variants and unified those as well.
* | Deprecate `active_support/core_ext/hash/compact`yuuji.yaginuma2018-03-021-2/+0
| | | | | | | | | | Ruby 2.4+ provides `Hash#compact` and `Hash#compact!` natively, so `active_support/core_ext/hash/compact` is no longer necessary.
* | Rebuild activestorage.jsGeorge Claghorn2018-02-281-1/+1
| |
* | Handle file checksumming errorsGeorge Claghorn2018-02-281-0/+6
| |