mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user