Skip to content

Commit

Permalink
Add: Add hash buster
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Feb 20, 2024
1 parent 2069564 commit afb99dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions backend/app/controllers/sonolus/asset_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ def self.asset_get(type, name)
elsif v.start_with?("!file:")
name, srl_type = v.delete_prefix("!file:").split("/")
srl_type ||= name
hash =
Digest::SHA1.file(
Rails.root.join("assets", "#{type}s", name)
).hexdigest
v = {
hash:
Digest::SHA1.file(
Rails.root.join("assets", "#{type}s", name)
).hexdigest,
url: "/sonolus/assets/#{type}s/#{name}",
hash:,
url: "/sonolus/assets/#{type}s/#{name}?hash=#{hash}",
type: srl_type
}
end
Expand Down

0 comments on commit afb99dc

Please sign in to comment.