mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4eebb51d01
2 changed files with 14 additions and 0 deletions
|
@ -27,6 +27,11 @@ class ActiveVault::Site::GCSSite < ActiveVault::Site
|
|||
end
|
||||
|
||||
|
||||
def url(key, expires_in:, disposition:, filename:)
|
||||
file_for(key).signed_url(expires: expires_in) + "&" +
|
||||
{ "response-content-disposition" => "#{disposition}; filename=\"#{filename}\"" }.to_query
|
||||
end
|
||||
|
||||
def byte_size(key)
|
||||
file_for(key).size
|
||||
end
|
||||
|
|
|
@ -5,6 +5,15 @@ if SITE_CONFIGURATIONS[:gcs]
|
|||
SITE = ActiveVault::Site.configure(:GCS, SITE_CONFIGURATIONS[:gcs])
|
||||
|
||||
include ActiveVault::Site::SharedSiteTests
|
||||
|
||||
test "signed URL generation" do
|
||||
travel_to Time.now do
|
||||
url = SITE.bucket.signed_url(path: FIXTURE_KEY, expires: 120) +
|
||||
"&response-content-disposition=inline%3B+filename%3D%22test.txt%22"
|
||||
|
||||
assert_equal url, @site.url(FIXTURE_KEY, expires_in: 2.minutes, disposition: :inline, filename: "test.txt")
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
puts "Skipping GCS Site tests because no GCS configuration was supplied"
|
||||
|
|
Loading…
Reference in a new issue