FIX: Sort filelists to ensure consistant asset precompilation hash (#13393)

Dir.glob does not guarantee file order and can change when ran on different machines.
This means that running asset precompilation on the exact same codebase will output
different content hashes.
This commit is contained in:
Brandon Gastelo 2021-06-16 08:04:21 -07:00 committed by GitHub
parent 82ebc706aa
commit 20dbcbf022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ module I18n
end
def self.sort_locale_files(files)
files.sort_by do |filename|
files.sort.sort_by do |filename|
matches = /(?:client|server)-([1-9]|[1-9][0-9]|100)\..+\.yml/.match(filename)
matches&.[](1)&.to_i || 0
end

View File

@ -755,7 +755,7 @@ class Plugin::Instance
root_path = "#{File.dirname(@path)}/assets/javascripts"
admin_path = "#{File.dirname(@path)}/admin/assets/javascripts"
Dir.glob(["#{root_path}/**/*", "#{admin_path}/**/*"]) do |f|
Dir.glob(["#{root_path}/**/*", "#{admin_path}/**/*"]).sort.each do |f|
f_str = f.to_s
if File.directory?(f)
yield [f, true]