aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-01-27 14:09:09 -0500
committerRafael França <rafaelmfranca@gmail.com>2016-01-27 14:09:09 -0500
commit96249afa62af0b528e4b7043e05397d3bc4d96c8 (patch)
tree9bc651bcb607eab46bbae5da90d65f25d2c6058c /actionview
parent6ed7570d7c557ef6f5507e2633096baeb0708c1c (diff)
parent5e3a23a3079488a9fc8434e312df838a51732917 (diff)
downloadrails-96249afa62af0b528e4b7043e05397d3bc4d96c8.tar.gz
rails-96249afa62af0b528e4b7043e05397d3bc4d96c8.tar.bz2
rails-96249afa62af0b528e4b7043e05397d3bc4d96c8.zip
Merge pull request #23288 from bdewater/sprockets3-sha2-alt
Fix img alt attribute generation when using Sprockets >= 3.0
Diffstat (limited to 'actionview')
-rw-r--r--actionview/CHANGELOG.md5
-rw-r--r--actionview/lib/action_view/helpers/asset_tag_helper.rb2
2 files changed, 6 insertions, 1 deletions
diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md
index 98ac2c1c22..d85681e0d1 100644
--- a/actionview/CHANGELOG.md
+++ b/actionview/CHANGELOG.md
@@ -1,3 +1,8 @@
+* Fix stripping the digest from the automatically generated img tag alt
+ attribute when assets are handled by Sprockets >=3.0.
+
+ *Bart de Water*
+
* Create a new `ActiveSupport::SafeBuffer` instance when `content_for` is flushed.
Fixes #19890
diff --git a/actionview/lib/action_view/helpers/asset_tag_helper.rb b/actionview/lib/action_view/helpers/asset_tag_helper.rb
index cc54faa778..413c35954c 100644
--- a/actionview/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/asset_tag_helper.rb
@@ -239,7 +239,7 @@ module ActionView
# image_alt('underscored_file_name.png')
# # => Underscored file name
def image_alt(src)
- File.basename(src, '.*'.freeze).sub(/-[[:xdigit:]]{32}\z/, ''.freeze).tr('-_'.freeze, ' '.freeze).capitalize
+ File.basename(src, '.*'.freeze).sub(/-[[:xdigit:]]{32,64}\z/, ''.freeze).tr('-_'.freeze, ' '.freeze).capitalize
end
# Returns an HTML video tag for the +sources+. If +sources+ is a string,