debian-mirror-gitlab/lib/gitlab/patch/sprockets_base_file_digest_key.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
688 B
Ruby
Raw Normal View History

2019-03-02 22:35:43 +05:30
# frozen_string_literal: true
# This monkey patch prevent cache ballooning when caching tmp/cache/assets/sprockets
# on the CI. See https://github.com/rails/sprockets/issues/563 and
# https://github.com/rails/sprockets/compare/3.x...jmreid:no-mtime-for-digest-key.
module Gitlab
module Patch
module SprocketsBaseFileDigestKey
def file_digest(path)
if stat = self.stat(path)
digest = self.stat_digest(path, stat)
2019-07-07 11:18:12 +05:30
integrity_uri = self.integrity_uri(digest)
2019-03-02 22:35:43 +05:30
key = Sprockets::UnloadedAsset.new(path, self).file_digest_key(integrity_uri)
cache.fetch(key) do
digest
end
end
end
end
end
end