Commit Graph

73 Commits

Author SHA1 Message Date
George Claghorn
921b877c2f Restore support for the -layers transformation 2018-01-02 07:20:23 -05:00
George Claghorn
316d87e412 Append extension to tempfile name
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.
2017-12-31 10:36:58 -05:00
Robert Glaser
7a3a991f6d Add support for combined MiniMagick transformations 2017-12-22 16:44:34 +01:00
George Claghorn
95117a2ce2 Convert non-web image (e.g. PSD) variants to PNG 2017-12-18 07:49:24 -05:00
George Claghorn
af0caadb8d Handle invalid signed blob IDs gracefully 2017-12-15 19:26:53 -05:00
George Claghorn
311af752cf Restrict variants to variable image blobs 2017-12-15 10:45:00 -05:00
Sean Griffin
edc54fd206
Merge pull request #31434 from olivierlacan/boot-feedback
Provide instant feedback when booting Rails
2017-12-14 16:49:02 -07:00
Ryuta Kamizono
245c1dafa8 Enable Layout/LeadingCommentSpace to not allow cosmetic changes in the future
Follow up of #31432.
2017-12-14 17:30:54 +09:00
Olivier Lacan
acc03bb695 Provide instant feedback when booting Rails
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)
2017-12-13 20:50:27 -05:00
George Claghorn
da8e0ba03c Swap raw video width and height if angle is 90 or 270 degrees 2017-12-08 13:15:04 -05:00
George Claghorn
e8286ee272 Fix customizing Content-Type via GCS service URLs 2017-12-07 15:16:24 -05:00
George Claghorn
8c5a7fbefd
Purge variants with their blobs 2017-12-02 22:43:28 -05:00
yuuji.yaginuma
9d65ac30fd Use credentials instead of keyfile in GCS sevice
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.
ddf7b2a856/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
2017-11-29 13:17:04 +09:00
George Claghorn
fbb12910bd Avoid connecting to GCS during app boot 2017-11-23 19:48:25 -05:00
George Claghorn
1d24e47140
Provide attachment writers
Permit creating a record and attaching files in a single step.

    # Before:
    User.create!(user_params.except(:avatar)).tap do |user|
      user.avatar.attach(user_params[:avatar])
    end

    # After:
    User.create!(user_params)

[Yoshiyuki Hirano & George Claghorn]
2017-11-20 18:06:06 -05:00
George Claghorn
ae7593e7e8 Load 5.2 defaults in ASt dummy app 2017-11-20 10:57:33 -05:00
George Claghorn
2d20a7696a Fix direct uploads to local service
Disable CSRF protection for ActiveStorage::DiskController#update. The local disk service is intended to imitate a third-party service like S3 or GCS, so we don't care where direct uploads originate: they’re authorized by signed tokens.

Closes #30290.

[Shinichi Maeshima & George Claghorn]
2017-11-20 10:54:46 -05:00
George Claghorn
e05e2ae44f Permit attaching files to new records
Closes #31164.
2017-11-19 17:34:07 -05:00
Ryuta Kamizono
1a0f85e139 Fix ASt CI failure with rack-test 0.7.1
Due to 5fd3631078.
2017-11-20 05:11:12 +09:00
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