aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage
Commit message (Collapse)AuthorAgeFilesLines
* Permit opening a blob in a custom tempdirGeorge Claghorn2018-05-173-7/+12
|
* Generate getter and setter methods in mixinJosh Susser2018-05-171-2/+2
| | | | | | | | | | | 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>
* 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-164-7/+59
| | | | [David Robertson & George Claghorn]
* Support streaming downloads from Google Cloud StorageGeorge Claghorn2018-05-011-19/+25
|
* 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-291-1/+1
| | | | Match other services, which all use a 5 MB chunk size.
* Merge pull request #31956 from fatkodima/has_attached-presence-validationEileen M. Uchitelle2018-04-271-0/+4
|\ | | | | has_(one/many)_attached presence validation
| * has_(one/many)_attached presence validationfatkodima2018-02-111-0/+4
| |
* | Simplify URL generation for partial downloads from GCSGeorge Claghorn2018-04-251-1/+2
| |
* | 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-231-5/+6
|\ \ | | | | | | Use ImageProcessing gem for ActiveStorage variants
| * | Rename ActiveStorage.processor to .variant_processorJanko Marohnić2018-04-221-6/+6
| | |
| * | Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Use a current model to provide the host for service urlsAndrew White2018-04-061-4/+7
| | | | | | | | | | | | | | 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).
* | Allow full use of the AWS S3 SDK authentication options (#32270)Brian Knight2018-03-191-2/+2
| | | | | | | | | | | | | | | | | | 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
* | Fix Azure signed URL generation with newer client libGeorge Claghorn2018-03-121-6/+4
| |
* | Remove path config option from Azure serviceAndrew White2018-03-121-6/+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-064-28/+74
| | | | | | | | | | | | 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.
* | Allow selectively purging attached blobsNicholas Shirley2018-03-062-12/+18
| |
* | 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-052-23/+17
| |
* | Delete dependent attachments with recordGeorge Claghorn2018-03-051-2/+2
| | | | | | | | [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-056-8/+53
| | | | | | | | Fixes #32129.
* | Handle another case where a blob might be erroneously purgedGeorge Claghorn2018-03-041-5/+10
| |
* | Avoid purging attached blob when replacing it with itselfGeorge Claghorn2018-03-041-2/+6
| |
* | 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.
* | Avoid specifying content types for direct uploads to Google Cloud StorageGeorge Claghorn2018-02-261-5/+4
| | | | | | | | Fix customizing the download Content-Type for a directly-uploaded blob via a signed URL. See e8286ee.
* | Use lazy load hook to configure ActiveStorage::BlobEugene Kenny2018-02-251-1/+1
| | | | | | | | | | | | | | | | | | `to_prepare` callbacks are run during initialization; using one here meant that `ActiveStorage::Blob` would be loaded when the app boots, which would in turn load `ActiveRecord::Base`. By using a lazy load hook to configure `ActiveStorage::Blob` instead, we can avoid loading `ActiveRecord::Base` unnecessarily.
* | Support varying ICO filesGeorge Claghorn2018-02-241-1/+9
|/ | | | Closes #32096.
* Correct orientation detectionGeorge Claghorn2018-01-311-1/+1
|
* Swap encoded image width and height if angle is 90 or 270 degreesGeorge Claghorn2018-01-311-1/+11
|
* Start Rails 6.0 development!!!Rafael Mendonça França2018-01-301-3/+3
| | | | :tada::tada::tada:
* Unlink internal tempfiles after useGeorge Claghorn2018-01-262-2/+22
|
* Add missing requireGeorge Claghorn2018-01-221-3/+5
|
* Cope with videos with undefined display aspect ratiosGeorge Claghorn2018-01-201-2/+6
|
* Preserve display aspect ratio for videos with rectangular samplesGeorge Claghorn2018-01-191-15/+35
|
* Provide a sensible default hostGeorge Claghorn2018-01-161-1/+1
|
* Extract content types from blob dataGeorge Claghorn2018-01-151-17/+11
|
* Instrument preview image drawingGeorge Claghorn2018-01-101-3/+5
|
* Add missing `# frozen_string_literal: true`Ryuta Kamizono2018-01-111-0/+2
|
* Extract Analyzable and Representable concernsGeorge Claghorn2018-01-101-0/+5
|
* Change Active Storage destroy callbackskami-zh2018-01-091-2/+2
| | | | | There is concern that only blob are deleted depending on the `before_destroy` definition order which throws abort.
* Fix attaching blobs to optimistically-locked recordsGeorge Claghorn2018-01-081-2/+2
| | | | | | Explicitly declare inverse associations so ActiveStorage::Attachment touches the original record instance. Closes #31542.
* Document automatic width-height swapping [ci skip]George Claghorn2018-01-071-0/+2
|
* Remove redundant sentences [ci skip]George Claghorn2018-01-072-4/+2
|