aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test
Commit message (Collapse)AuthorAgeFilesLines
* Always exclude JSON root from direct_uploads#create responseJavan Makhmali2018-04-101-0/+23
| | | | | | The JavaScript component expects a bare response. Fixes #32365
* Use a current model to provide the host for service urlsAndrew White2018-04-063-2/+10
| | | | | | | 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).
* Flip the order of the after_create callbacksDwight Watson2018-03-272-3/+23
| | | | | | | | | | 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
* Allow full use of the AWS S3 SDK authentication options (#32270)Brian Knight2018-03-191-1/+1
| | | | | | | | | 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
* Update ASt test services configGeorge Claghorn2018-03-121-0/+0
|
* Remove path config option from Azure serviceAndrew White2018-03-121-1/+0
| | | | | | | | | | | 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-062-3/+26
| | | | | | 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-061-0/+28
|
* Fix purging dependent blobs when attachments aren't loadedGeorge Claghorn2018-03-052-2/+18
|
* Delete dependent attachments with recordGeorge Claghorn2018-03-052-0/+15
| | | | [Matt Jones & George Claghorn]
* Generate root-relative paths in Active Storage disk service URL methodsGeorge Claghorn2018-03-055-7/+6
| | | | Fixes #32129.
* Handle another case where a blob might be erroneously purgedGeorge Claghorn2018-03-041-0/+12
|
* Avoid purging attached blob when replacing it with itselfGeorge Claghorn2018-03-041-0/+12
|
* Merge Previews/Variants controller into one Representations controller.Kasper Timm Hansen2018-03-033-65/+61
| | | | | | | | | 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.
* Update test to reflect direct upload header changesGeorge Claghorn2018-02-261-1/+1
|
* Avoid specifying content types for direct uploads to Google Cloud StorageGeorge Claghorn2018-02-261-1/+1
| | | | Fix customizing the download Content-Type for a directly-uploaded blob via a signed URL. See e8286ee.
* Support varying ICO filesGeorge Claghorn2018-02-242-0/+11
| | | | Closes #32096.
* Allow S3 tests against buckets in other regionsAndrew White2018-02-212-2/+2
| | | | | Only us-east-1 gives URLs like bucket.s3.amazonaws.com whereas other regions have URLs like s3-eu-west-1.amazonaws.com/ubxd-rails
* Add ActiveStorage::Blob.unattached scopefatkodima2018-02-121-0/+17
|
* Fix `blob.service_url` for supports string or nil `:filename` option.Jason Lee2018-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - Make sure `blob.service_url` present a `ActiveStorage::Filename` type to `serivce.url`. - Add `ActiveStorage::Filename.wrap` method. before: ```rb blob.service_url(filename: ActiveStorage::Filename.new("new.txt")) blob.service_url(filename: "new.txt") => NoMethodError: undefined method `parameters' for "new.txt":String params = {} blob.service_url(filename: params[:filename]) => NoMethodError: undefined method `parameters' for nil:NilClass ``` after: ```rb blob.service_url(filename: "new.txt") blob.service_url(filename: nil) ```
* Allow `ActiveStorage::Blob#service_url` to pass addition options to ↵Jason Lee2018-02-011-0/+20
| | | | | | | | | | | | | | | | | | | | | | | `service.url`. Because there have some service needs more parameters for file URL: https://www.alibabacloud.com/help/doc-detail/44687.htm ```rb class AliyunService < Service def url(key, options = {}) image_process = options[:oss_process] || "image/resize,w_800" "http://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=#{image_process}" end end ``` Use case: ```erb <%= image_tag @user.avatar.service_url(oss_process: "image/resize,m_fill,h_100,w_100" %> ```
* Correct orientation detectionGeorge Claghorn2018-01-311-2/+2
|
* Swap encoded image width and height if angle is 90 or 270 degreesGeorge Claghorn2018-01-312-2/+15
|
* Add a test for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?Shuhei Kitagawa2018-01-291-0/+12
|
* Eliminate ActiveStorage::Service::MirrorServiceTest#uploadShuhei Kitagawa2018-01-271-16/+16
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-256-24/+24
|
* Cope with videos with undefined display aspect ratiosGeorge Claghorn2018-01-202-0/+9
|
* Use helper methodGeorge Claghorn2018-01-191-1/+2
|
* Preserve display aspect ratio for videos with rectangular samplesGeorge Claghorn2018-01-192-4/+18
|
* Revert "Merge pull request #31434 from olivierlacan/boot-feedback"Matthew Draper2018-01-191-4/+0
| | | | | | | | | This reverts commit edc54fd2068bc21f0d381228e55d97e32f508923, reversing changes made to a5922f132f4d163e2c7f770427087f5268c18def. As discussed, this is not an appropriate place to make assumptions about ARGV, or to write to stdout: config/boot.rb is a library and is required by other applictions, with which we have no right to interfere.
* Refactor migration to move migrations paths to connectioneileencodes2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails has some support for multiple databases but it can be hard to handle migrations with those. The easiest way to implement multiple databases is to contain migrations into their own folder ("db/migrate" for the primary db and "db/seconddb_migrate" for the second db). Without this you would need to write code that allowed you to switch connections in migrations. I can tell you from experience that is not a fun way to implement multiple databases. This refactoring is a pre-requisite for implementing other features related to parallel testing and improved handling for multiple databases. The refactoring here moves the class methods from the `Migrator` class into it's own new class `MigrationContext`. The goal was to move the `migrations_paths` method off of the `Migrator` class and onto the connection. This allows users to do the following in their `database.yml`: ``` development: adapter: mysql2 username: root password: development_seconddb: adapter: mysql2 username: root password: migrations_paths: "db/second_db_migrate" ``` Migrations for the `seconddb` can now be store in the `db/second_db_migrate` directory. Migrations for the primary database are stored in `db/migrate`". The refactoring here drastically reduces the internal API for migrations since we don't need to pass `migrations_paths` around to every single method. Additionally this change does not require any Rails applications to make changes unless they want to use the new public API. All of the class methods from the `Migrator` class were `nodoc`'d except for the `migrations_paths` and `migrations_path` getter/setters respectively.
* Provide a sensible default hostGeorge Claghorn2018-01-165-7/+5
|
* Extract content types from blob dataGeorge Claghorn2018-01-159-10/+51
|
* Extract Analyzable and Representable concernsGeorge Claghorn2018-01-103-3/+3
|
* Allow overriding filename in `Blob#service_url`Rosa Gutierrez2018-01-081-3/+14
| | | | | | | This is useful when we have several representations for the same underlying file, each one with a different name, and we need to provide a custom download URL based on that name and not that of the underlying file.
* Force content disposition to attachment for specific content typesRosa Gutierrez2018-01-051-0/+9
| | | | | | | | | | | | | | In this way we avoid HTML, XML, SVG and other files that can be rendered by the browser to be served inline by default. Depending on the origin from where these files are served, this might lead to XSS vulnerabilities, and in the best case, to more realistic phishing attacks and open redirects. We force it rather than falling back to it when other disposition is not provided. Otherwise it would be possible for someone to force inline just by passing `disposition=inline` in the URL. The list of content types to be served as attachments is configurable.
* Restore support for the -layers transformationGeorge Claghorn2018-01-022-0/+8
|
* Append extension to tempfile nameGeorge Claghorn2017-12-312-1/+22
| | | | | | Fixes analyzing an SVG image without an XML declaration. ImageMagick occasionally looks to the extension when it can't discern the type of an image file from its contents. References #31356.
* Add support for combined MiniMagick transformationsRobert Glaser2017-12-221-0/+14
|
* Convert non-web image (e.g. PSD) variants to PNGGeorge Claghorn2017-12-182-9/+19
|
* Handle invalid signed blob IDs gracefullyGeorge Claghorn2017-12-153-0/+23
|
* Restrict variants to variable image blobsGeorge Claghorn2017-12-151-0/+6
|
* Merge pull request #31434 from olivierlacan/boot-feedbackSean Griffin2017-12-141-0/+4
|\ | | | | Provide instant feedback when booting Rails
| * Provide instant feedback when booting RailsOlivier Lacan2017-12-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've noticed during pair/mob programming sessions with peers that despite the speed boosts provided by Bootsnap and Spring, there is a noticeable latency between firing a bin/rails server command and any feedback being provided to the console. Depending on the size of the application this lack of feedback can make it seem like something is wrong when Rails is simply busy initializing. This change may seem gratuitous but by just printing one line to STDOUT we're giving a clear signal to the Rails user that their command has been received and that Rails is indeed booting. It almost imperciptibly makes Rails feel more responsive. Sure the code doesn't look very fancy but there's no other appropriate place I could think of putting it than boot.rb. Compare these two GIFs of booting without and with this change: Before: ![Without Boot Feedback](https://user-images.githubusercontent.com/65950/33964140-721041fc-e025-11e7-9b25-9d839ce92977.gif) After: ![With Boot Feedback](https://user-images.githubusercontent.com/65950/33964151-79e12f86-e025-11e7-93e9-7a75c70d408f.gif)
* | Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-141-4/+0
|/ | | | Follow up of #31432.
* Swap raw video width and height if angle is 90 or 270 degreesGeorge Claghorn2017-12-081-2/+2
|
* Fix customizing Content-Type via GCS service URLsGeorge Claghorn2017-12-071-0/+14
|
* Purge variants with their blobsGeorge Claghorn2017-12-022-1/+26
|
* Use `credentials` instead of `keyfile` in GCS seviceyuuji.yaginuma2017-11-291-1/+1
| | | | | | | | | | | | | The `keyfile` was renamed to `credentials` in `google-cloud-storage` 1.8.0. https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/google-cloud-storage/CHANGELOG.md#180--2017-11-14 Although `keyfile` can still be used, but it looks like deprecate. https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/ddf7b2a856d676316525eb581c1a4cc83ca6097b/google-cloud-storage/lib/google/cloud/storage.rb#L589...L590 Therefore, I think that should use `credentials` in newly generated applications. Ref: https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues/1802