Skip to content

Commit

Permalink
Use leading slash for invalidations (#6120)
Browse files Browse the repository at this point in the history
* Use leading slash for invalidations

* Update test
  • Loading branch information
iHiD authored Sep 7, 2023
1 parent c6e58cc commit 4534992
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/commands/user/invalidate_avatar_in_cloudfront.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def call
def items
# Invalidate the old versions too. We don't want to leave
# photos of people in our caches when they delete them.
(0..user.version).map { |version| "avatars/#{user.id}/#{version}" }
(0..user.version).map { |version| "/avatars/#{user.id}/#{version}" }
end

def distribution_id
Expand Down
8 changes: 4 additions & 4 deletions test/commands/user/invalidate_avatar_in_cloudfront_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class User::InvalidateAvatarInCloudfrontTest < ActiveSupport::TestCase
paths: {
quantity: 4,
items: [
"avatars/#{user.id}/0",
"avatars/#{user.id}/1",
"avatars/#{user.id}/2",
"avatars/#{user.id}/3"
"/avatars/#{user.id}/0",
"/avatars/#{user.id}/1",
"/avatars/#{user.id}/2",
"/avatars/#{user.id}/3"
]
},
caller_reference: "avatar-invalidation-for-user-#{user.id}-#{Time.current.to_i}"
Expand Down

0 comments on commit 4534992

Please sign in to comment.