aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorBart de Water <bart@somnilocode.nl>2016-01-27 19:35:37 +0100
committerBart de Water <bart@somnilocode.nl>2016-01-27 19:38:13 +0100
commit5e3a23a3079488a9fc8434e312df838a51732917 (patch)
treeb0f293cd34999564232390ae57917e48dafeb04d /actionview
parent9864bcee8cfdb9e798473e01936b4499e268a64d (diff)
downloadrails-5e3a23a3079488a9fc8434e312df838a51732917.tar.gz
rails-5e3a23a3079488a9fc8434e312df838a51732917.tar.bz2
rails-5e3a23a3079488a9fc8434e312df838a51732917.zip
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,