diff options
author | khall <kevinmichaelhall@gmail.com> | 2017-10-04 12:26:04 -0700 |
---|---|---|
committer | khall <kevinmichaelhall@gmail.com> | 2017-10-05 20:57:33 -0700 |
commit | ead60686e810df4b49bf19f4f113b48f16ae560f (patch) | |
tree | 4792706af93e46d4edb7a952160152efadc265ed /activestorage/test | |
parent | bd2542b74fe528d95f51d8f3668b0f7d6d8af974 (diff) | |
download | rails-ead60686e810df4b49bf19f4f113b48f16ae560f.tar.gz rails-ead60686e810df4b49bf19f4f113b48f16ae560f.tar.bz2 rails-ead60686e810df4b49bf19f4f113b48f16ae560f.zip |
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.
Diffstat (limited to 'activestorage/test')
-rw-r--r-- | activestorage/test/models/variant_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activestorage/test/models/variant_test.rb b/activestorage/test/models/variant_test.rb index d7cbef4e55..b7d20ab55a 100644 --- a/activestorage/test/models/variant_test.rb +++ b/activestorage/test/models/variant_test.rb @@ -26,4 +26,9 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase assert_equal 67, image.height assert_match(/Gray/, image.colorspace) end + + test "service_url doesn't grow in length despite long variant options" do + variant = @blob.variant(font: "a" * 10_000).processed + assert_operator variant.service_url.length, :<, 500 + end end |