paperclip-gcs 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/paperclip/gcs/version.rb +1 -1
- data/lib/paperclip/storage/gcs.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9401a2869fe785ab10d07de65a786849eb8f7954a799a14519e4177bea89a17b
|
4
|
+
data.tar.gz: 2afb841d3f6238b775273349e4f949c0647d9657c4b6eeaf9c9bc975bd398172
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c6e8472cabdc9ed99418bb63de24d1e55f2905eb90f3d71ef87e8aad51c6826b6f39141a08aa3068d2dd5a3c1cf0dce785301e9aadcb1819818469a11834f1
|
7
|
+
data.tar.gz: 445cde3dcfef1ba45bc60ac13483b85276eeea01d136dd0f1339cd8f51cf6cb0708b538f68f2ac64e13c09409e8b4c08ea7640257ea11316f13a07dc23ef0182
|
data/README.md
CHANGED
@@ -184,6 +184,14 @@ gcs_storage_class: :multi_regional
|
|
184
184
|
|
185
185
|
The Cache-Control metadata allows you to control whether and for how long browser and Internet caches are allowed to cache your objects.
|
186
186
|
|
187
|
+
### gcs_content_disposition
|
188
|
+
|
189
|
+
The Content-Disposition metadata allows you to specify the presentation of the object in the browser.
|
190
|
+
|
191
|
+
### gcs_content_type
|
192
|
+
|
193
|
+
The Content-Type metadata allows you to specify the content type of the object. By default it will use the file content type.
|
194
|
+
|
187
195
|
### Interpolates
|
188
196
|
|
189
197
|
#### :gcs_alias_url
|
@@ -23,6 +23,8 @@ module Paperclip
|
|
23
23
|
@gcs_permissions = normalize_style(@options[:gcs_permissions])
|
24
24
|
@gcs_storage_class = normalize_style(@options[:gcs_storage_class])
|
25
25
|
@gcs_cache_control = normalize_style(@options[:gcs_cache_control])
|
26
|
+
@gcs_content_type = normalize_style(@options[:gcs_content_type])
|
27
|
+
@gcs_content_disposition = normalize_style(@options[:gcs_content_disposition])
|
26
28
|
|
27
29
|
unless @options[:url].to_s.match(%r{\A:gcs_(alias|path|domain)_url\z}) || @options[:url] == ":asset_host".freeze
|
28
30
|
@options[:path] = path_option.gsub(/:url/, @options[:url]).sub(%r{\A:rails_root/public/system}, "".freeze)
|
@@ -70,7 +72,8 @@ module Paperclip
|
|
70
72
|
log("saving #{path(style)}")
|
71
73
|
|
72
74
|
opts = {
|
73
|
-
content_type: file
|
75
|
+
content_type: gcs_content_type(file, style),
|
76
|
+
content_disposition: gcs_content_disposition(style),
|
74
77
|
cache_control: gcs_cache_control(style),
|
75
78
|
encryption_key: gcs_encryption_key,
|
76
79
|
acl: gcs_permissions(style),
|
@@ -141,6 +144,14 @@ module Paperclip
|
|
141
144
|
unwrap_proc(@gcs_permissions[style] || @gcs_permissions[:default], self, style)
|
142
145
|
end
|
143
146
|
|
147
|
+
def gcs_content_type(file, style = default_style)
|
148
|
+
unwrap_proc(@gcs_content_type[style] || @gcs_content_type[:default], self, style) || file.content_type
|
149
|
+
end
|
150
|
+
|
151
|
+
def gcs_content_disposition(style = default_style)
|
152
|
+
unwrap_proc(@gcs_content_disposition[style] || @gcs_content_disposition[:default], self, style)
|
153
|
+
end
|
154
|
+
|
144
155
|
def gcs_storage_class(style = default_style)
|
145
156
|
unwrap_proc(@gcs_storage_class[style] || @gcs_storage_class[:default], self, style)
|
146
157
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-gcs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daichi HIRATA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kt-paperclip
|