Skip to content

Commit 76d1f65

Browse files
committed
Comment on awkward construction of integrity option handling and side effects to clarify that it's ugly but intentional
1 parent 54e6cf2 commit 76d1f65

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/sprockets/rails/helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ def stylesheet_link_tag(*sources)
162162
end
163163

164164
protected
165+
# This is awkward: `integrity` is a boolean option indicating whether
166+
# we want to include or omit the subresource integrity hash, but the
167+
# options hash is also passed through as literal tag attributes.
168+
# That means we have to delete the shortcut boolean option so it
169+
# doesn't bleed into the tag attributes, but also check its value if
170+
# it's boolean-ish.
165171
def compute_integrity?(options)
166172
if secure_subresource_integrity_context?
167173
case options['integrity']

0 commit comments

Comments
 (0)