paperclip 2.3.10 → 2.3.11

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of paperclip might be problematic. Click here for more details.

@@ -94,8 +94,8 @@ module Paperclip
94
94
  end unless Paperclip::Interpolations.respond_to? :s3_domain_url
95
95
  end
96
96
 
97
- def expiring_url(time = 3600)
98
- AWS::S3::S3Object.url_for(path, bucket_name, :expires_in => time )
97
+ def expiring_url(time = 3600, style_name = default_style)
98
+ AWS::S3::S3Object.url_for(path(style_name), bucket_name, :expires_in => time, :use_ssl => (s3_protocol == 'https'))
99
99
  end
100
100
 
101
101
  def bucket_name
@@ -1,3 +1,3 @@
1
1
  module Paperclip
2
- VERSION = "2.3.10" unless defined? Paperclip::VERSION
2
+ VERSION = "2.3.11" unless defined? Paperclip::VERSION
3
3
  end
@@ -114,7 +114,7 @@ class StorageTest < Test::Unit::TestCase
114
114
  end
115
115
  end
116
116
 
117
- context "Generating a url with an expiration" do
117
+ context "Generating a secure url with an expiration" do
118
118
  setup do
119
119
  AWS::S3::Base.stubs(:establish_connection!)
120
120
  rebuild_model :storage => :s3,
@@ -123,6 +123,7 @@ class StorageTest < Test::Unit::TestCase
123
123
  :development => { :bucket => "dev_bucket" }
124
124
  },
125
125
  :s3_host_alias => "something.something.com",
126
+ :s3_permissions => "private",
126
127
  :path => ":attachment/:basename.:extension",
127
128
  :url => ":s3_alias_url"
128
129
 
@@ -131,7 +132,7 @@ class StorageTest < Test::Unit::TestCase
131
132
  @dummy = Dummy.new
132
133
  @dummy.avatar = StringIO.new(".")
133
134
 
134
- AWS::S3::S3Object.expects(:url_for).with("avatars/stringio.txt", "prod_bucket", { :expires_in => 3600 })
135
+ AWS::S3::S3Object.expects(:url_for).with("avatars/stringio.txt", "prod_bucket", { :expires_in => 3600, :use_ssl => true })
135
136
 
136
137
  @dummy.avatar.expiring_url
137
138
  end
@@ -141,6 +142,35 @@ class StorageTest < Test::Unit::TestCase
141
142
  end
142
143
  end
143
144
 
145
+ context "Generating a url with an expiration" do
146
+ setup do
147
+ AWS::S3::Base.stubs(:establish_connection!)
148
+ rebuild_model :storage => :s3,
149
+ :s3_credentials => {
150
+ :production => { :bucket => "prod_bucket" },
151
+ :development => { :bucket => "dev_bucket" }
152
+ },
153
+ :s3_host_alias => "something.something.com",
154
+ :path => ":attachment/:style/:basename.:extension",
155
+ :url => ":s3_alias_url"
156
+
157
+ rails_env("production")
158
+
159
+ @dummy = Dummy.new
160
+ @dummy.avatar = StringIO.new(".")
161
+
162
+ AWS::S3::S3Object.expects(:url_for).with("avatars/original/stringio.txt", "prod_bucket", { :expires_in => 3600, :use_ssl => false })
163
+ @dummy.avatar.expiring_url
164
+
165
+ AWS::S3::S3Object.expects(:url_for).with("avatars/thumb/stringio.txt", "prod_bucket", { :expires_in => 1800, :use_ssl => false })
166
+ @dummy.avatar.expiring_url(1800, :thumb)
167
+ end
168
+
169
+ should "should succeed" do
170
+ assert true
171
+ end
172
+ end
173
+
144
174
  context "Parsing S3 credentials with a bucket in them" do
145
175
  setup do
146
176
  AWS::S3::Base.stubs(:establish_connection!)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
4
+ hash: 21
5
+ prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
- - 10
10
- version: 2.3.10
9
+ - 11
10
+ version: 2.3.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jon Yurek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-06 00:00:00 -04:00
18
+ date: 2011-04-08 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
223
  - ImageMagick
224
224
  rubyforge_project: paperclip
225
- rubygems_version: 1.3.7
225
+ rubygems_version: 1.4.1
226
226
  signing_key:
227
227
  specification_version: 3
228
228
  summary: File attachments as attributes for ActiveRecord