提交 f165628c 编写于 作者: G George Claghorn 提交者: GitHub

Merge pull request #30802 from khall/30662_long_variant_filenames

Break long variant filenames into path chunks
......@@ -50,7 +50,7 @@ def processed
# Returns a combination key of the blob and the variation that together identifies a specific variant.
def key
"variants/#{blob.key}/#{variation.key}"
"variants/#{blob.key}/#{Digest::SHA256.hexdigest(variation.key)}"
end
# Returns the URL of the variant on the service. This URL is intended to be short-lived for security and not used directly
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册