Commit Graph

54 Commits

Author SHA1 Message Date
George Claghorn
499a4164ce Introduce ActiveStorage::Attached::{One,Many}#detach 2017-11-14 10:42:51 -05:00
George Claghorn
704a7e425c Preserve existing metadata when analyzing a blob
Closes #31138.
2017-11-13 16:36:39 -05:00
George Claghorn
86938c495e
Fix streaming downloads from S3/Azure Storage
Closes #31073.
2017-11-06 21:29:37 -05:00
George Claghorn
605484079d Extract metadata from images and videos 2017-10-22 13:16:59 -04:00
bogdanvlviv
19323d3bcc
Use require_relative instead of require with full path in activestorage/
Related to #29417
2017-10-13 21:26:57 +03:00
bogdanvlviv
f1e47b0348
Define path with __dir__ in activestorage/
Related to #29176
2017-10-13 20:47:56 +03:00
George Claghorn
445c682a84 Introduce ActiveStorage::Blob#representation 2017-10-12 11:47:21 -04:00
khall
ead60686e8 Replace variation key use with SHA256 of key to prevent long filenames
If a variant has a large set of options associated with it, the generated
filename will be too long, causing Errno::ENAMETOOLONG to be raised. This
change replaces those potentially long filenames with a much more compact
SHA256 hash. Fixes #30662.
2017-10-05 20:57:33 -07:00
Ryuta Kamizono
325c06fbc4 Fix test "signed URL generation" failure
https://travis-ci.org/rails/rails/jobs/281044755#L5582-L5586
2017-09-30 05:48:23 +09:00
George Claghorn
d30586211b Preview PDFs and videos 2017-09-28 16:43:37 -04:00
Yoshiyuki Hirano
704bf9b9c6 Add with_attached_* scope to has_one_attached macro
* For avoiding N+1 problem, added `with_attached_*` scope to
  `has_one_attached` macro.
2017-09-19 06:02:00 +09:00
George Claghorn
21e690cba8 Rename activestorage/test/service/configurations.yml to activestorage/test/service/configurations.example.yml 2017-09-11 18:06:08 -04:00
George Claghorn
656ee8b2dd Fix replacing a singular attachment 2017-08-29 15:34:50 -04:00
Koichi ITO
9e470b24c8 Fix order of Active Storage DiskService URL parameters
`content_type` parameter is before `disposition` parameter.
2017-08-26 23:16:07 +09:00
Rafael Mendonça França
783295f706 Merge pull request #30213 from ckundo/ccundiff-alt-text-default
Do not generate default alt text for images
2017-08-23 11:51:34 -04:00
bogdanvlviv
92431ea5fb
Use 5.2 version of ActiveRecord::Migration for Active Storage 2017-08-22 17:32:43 +03:00
George Claghorn
63395aba5a Encode Content-Disposition filenames according to RFC 2231
Closes #30134.
2017-08-21 18:23:15 -04:00
George Claghorn
c7993299d9 Update regex 2017-08-20 18:58:19 -04:00
George Claghorn
332049d116 Fix tests 2017-08-20 18:45:39 -04:00
George Claghorn
376dd5c001 DRY 2017-08-20 18:09:44 -04:00
George Claghorn
8bd14971b9 Rename ActiveStorage::Filename#extname to extension_with_delimiter 2017-08-20 16:30:15 -04:00
Cameron Cundiff
9a74c7b99b Do not generate default alt text in image tags
- Auto-generating content from the filename of an image is not suitable
  alternative text; alt text that isn't fully considered can be
  distracting and fatiguing for screen readers users (blind, low vision,
  dyslexic people).
- Setting a filename fallback short circuits screen reader default
  behavior and configuration for blank descriptions.
- Setting poor defaults also creates false negatives for accessibility
  linting and testing software, that makes it harder to improve
  application accessibility.

***

- After this change, if authors leave images without alt text, screen
  readers will fallback to default behavior for missing alt text.
- Also with this change, Automated linting and testing tools will
  correctly generate warnings.

[Fixes #30096]
2017-08-17 16:13:15 -04:00
George Claghorn
d11d629feb Merge pull request #30292 from maclover7/jm-ast-purge
Add missing test for Blob#purge
2017-08-17 11:53:32 -04:00
Jon Moss
267fdcc4a4 Add missing test for Blob#purge 2017-08-17 11:09:33 -04:00
Jon Moss
07a13f7abb Use nil Logger for tests
Makes tests much more quietly, as opposed to the enormous amount of
logging that appears right now. This setting is used in AJ, as well as
other frameworks.

Output from test run:

```

.........................................................

Finished in 3.003355s, 18.9788 runs/s, 45.2827 assertions/s.
57 runs, 136 assertions, 0 failures, 0 errors, 0 skips
```
2017-08-17 09:47:23 -04:00
George Claghorn
3cfadd5fa2 Move test to its proper place
ActiveStorage::Filename is a model, so its test case belongs in test/models.
2017-08-14 16:04:11 -04:00
George Claghorn
3841fdc4e7 Run Active Storage service tests in CI 2017-08-14 13:48:17 -04:00
Koichi ITO
2b6e85c190 Should escape regexp wildcard character . 2017-08-14 22:17:50 +09:00
Koichi ITO
d02844f249 Use frozen string literal in Active Storage 2017-08-12 21:43:42 +09:00
Rafael França
4766b2da02 Merge pull request #30198 from betesh/activestorage-rack-test-uploaded-file
Activestorage rack test uploaded file
2017-08-11 17:46:02 -04:00
Rafael França
8562404c6b Merge pull request #30113 from dixpac/remove_unecessary_require_in_test_helper
ActiveStorage: Remove unnecessary require in test_helper
2017-08-11 17:35:18 -04:00
Isaac Betesh
4287f089d3 Make activestorage treat Rack::Test::UploadedFile just like ActionDispatch::Http::UploadedFile 2017-08-11 14:43:19 -04:00
Anton Khamets
e25466b142 Enable browser caching for blobs and variants (#30196) 2017-08-11 13:18:12 -04:00
George Claghorn
e43ba973a3 Run Active Storage tests in CI (#30144) 2017-08-10 15:58:30 -04:00
dixpac
e1f1213c8b Remove unecessary require in test_helper 2017-08-09 08:45:15 +02:00
Rafael França
96bcaedf1d Merge pull request #30112 from dixpac/filter_minitest_backtrace
ActiveStorage:Filter out Minitest backtrace.
2017-08-08 18:38:25 -04:00
Rafael Mendonça França
1422e9f9c9 Merge pull request #30135 from ffmike/azure-storage-fix-content-type
Support content_type in AzureStorageService#url
2017-08-08 14:42:03 -04:00
Dino Maric
4b72bee47b ActiveStorage:Add migrations per rails engine conventions (#30111)
* Add migrations per rails engine conventions

* Fix failing tests
2017-08-08 09:47:38 -05:00
Mike Gunderloy
6ef3794013
Support content_type in AzureStorageService#url
Add in the content_type option, which is defined as part of the generic
ActiveStorage::Service class.

Without this option, attempts to generate a URL for an attached file
fail with "ArgumentError (unknown keyword: content_type)"
2017-08-08 09:35:42 -05:00
Anton Khamets
7c89948c41 Extend image_tag to accept ActiveStorage Attachments and Variants (#30084)
* Extend image_tag to accept ActiveStorage's Attachments and Variants

* Flip resolve_image_source around

* Add tests for the new use-cases of image_tag

* Remove the higher-level test

* Update image_tag documentation

* Add error states into the test suite

* Re-raise polymorhic_url's NoMethodError as ArgumentError

* delegate_missing_to will raise DelegationError instead of NoMethodError
2017-08-07 09:38:51 -05:00
dixpac
d44e737a76 Filter out Minitest backtrace.
Filter out Minitest backtrace while allowing backtrace from other
libraries to be shown.
2017-08-07 11:40:20 +02:00
yuuji.yaginuma
46db463d06 Fix ruby warnings
This fixes following warnings:

```
test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator
lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized
lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized
```
2017-08-05 12:22:39 +09:00
Dino Maric
3179f089be Rename Azure to AzureStorage (#30057) 2017-08-04 17:57:02 -05:00
Claudio B
b9f0eb24ed Fix tests for AWS buckets that include a . (#30059)
If an AWS bucket name includes a `.` (e.g. `bucket.name`), then the canonical
URL for an object will start with "https://s3.amazonaws.com/bucket.name/"
and not with "https://bucket.name.s3.amazonaws.com/".

The URL tests have now been separated into two separate asserts, to ensure
that both the "s3.amazonaws.com" and the "bucket.name" components are included,
but not specifically in that order.
2017-08-04 17:56:14 -05:00
claudiob
9d636c9e2f Make Rubocop happier about ActiveStorage
Running `rubocop activestorage` before this commit resulted in 20 offenses.
This commit only fixes:

- Trailing whitespace detected
- Space inside } missing
- Put one space between the method name and the first argument.

The other offenses are left since they are intentional according to
@georgeclaghorn (https://github.com/rails/rails/pull/30061#issuecomment-319999190)
2017-08-03 11:43:08 -07:00
Ryuta Kamizono
815d1abf39 Fix Style/StringLiterals violations for Active Storage
```
% be rubocop -a --only Style/StringLiterals activestorage
Inspecting 74 files
........................................CCCCCCCCCC.C........CC.......C.C..

(snip)

74 files inspected, 31 offenses detected, 31 offenses corrected
```
2017-08-03 03:13:11 +09:00
David Heinemeier Hansson
ff3dad07ba Skip if credentials aren't provided 2017-08-01 17:22:20 -05:00
David Heinemeier Hansson
4f8be04f4e Fix dummy app for inclusion in Rails 2017-08-01 17:22:10 -05:00
Guillermo Iguaran
d66fadeb67 Merge pull request #30030 from claudiob/only-disk
Let ActiveStorage tests pass only for Disk
2017-08-01 13:05:23 -05:00
claudiob
98bb99ef61 Don't depend on HTTParty
"httparty" is only added in #30020 to write two tests to make PUT requests
against S3 and GCS.

The same requests can be made with net/http, removing a dependency from the Gemfile.
2017-08-01 10:56:39 -07:00