carrierwave_direct 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -359,6 +359,10 @@ The Active Record validations use the Rails i18n framework. Add these keys to yo
359
359
  carrierwave_direct_filename_invalid: is invalid. Allowed file types are ${extension_white_list}
360
360
  carrierwave_direct_remote_net_url_invalid: is invalid. Allowed file types are ${extension_white_list}. Allowed url schemes are ${url_scheme_white_list}
361
361
 
362
+ ## Caveats
363
+
364
+ Don't name your string column `file`. It will result in a stack level too deep exception. See [this issue](https://github.com/dwilkie/carrierwave_direct/issues/10) for more info
365
+
362
366
  ## Contributing to CarrierWaveDirect
363
367
 
364
368
  Pull requests are very welcome. Before submitting a pull request, please make sure that your changes are well tested.
@@ -372,6 +376,8 @@ You should now be able to run the tests
372
376
 
373
377
  ## Contributors
374
378
 
375
- * cblunt (Chris Blunt) - Support for passing html options
376
- * robyurkowski (Rob Yurkowski) - Fix deprecation warnings for Rails 3.2
377
- * tylr (Tyler Love) - Bug fix
379
+ * [cblunt (Chris Blunt)](https://github.com/cblunt) - Support for passing html options
380
+ * [robyurkowski (Rob Yurkowski)](https://github.com/robyurkowski) - Fix deprecation warnings for Rails 3.2
381
+ * [tylr (Tyler Love)](https://github.com/tylr) - Bug fix
382
+ * [vlado (Vlado Cingel)](https://github.com/vlado) - Properly sanitize filename
383
+ * [travisp (Travis Pew)](https://github.com/travisp) - Compatibility for CarrierWave 0.6.0
@@ -48,7 +48,7 @@ module CarrierWaveDirect
48
48
  end
49
49
 
50
50
  def acl
51
- s3_access_policy.to_s.gsub('_', '-')
51
+ fog_public ? 'public-read' : 'private'
52
52
  end
53
53
 
54
54
  def policy(options = {})
@@ -87,7 +87,7 @@ module CarrierWaveDirect
87
87
  unless has_key?
88
88
  # Use the attached models remote url to generate a new key otherwise return nil
89
89
  remote_url = model.send("remote_#{mounted_as}_url")
90
- remote_url ? key_from_file(remote_url.split("/").pop) : return
90
+ remote_url ? key_from_file(CarrierWave::SanitizedFile.new(remote_url).filename) : return
91
91
  end
92
92
 
93
93
  key_path = key.split("/")
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module CarrierwaveDirect
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
 
@@ -284,7 +284,20 @@ describe CarrierWaveDirect::Uploader do
284
284
  mounted_subject.filename
285
285
  end
286
286
  end
287
-
287
+
288
+ context "and the model's remote #{sample(:mounted_as)} url has whitespace in it" do
289
+ before do
290
+ mounted_model.stub(
291
+ "remote_#{mounted_subject.mounted_as}_url"
292
+ ).and_return("http://anyurl.com/any_path/video_dir/filename 2.avi")
293
+ end
294
+
295
+ it "should be sanitized (whitespace replaced with _)" do
296
+ mounted_subject.filename
297
+ mounted_subject.key.should =~ /filename_2.avi$/
298
+ end
299
+ end
300
+
288
301
  context "and the model's remote #{sample(:mounted_as)} url is blank" do
289
302
  before do
290
303
  mounted_model.stub(
@@ -300,8 +313,8 @@ describe CarrierWaveDirect::Uploader do
300
313
  end
301
314
 
302
315
  describe "#acl" do
303
- it "should return the sanitized s3 access policy" do
304
- subject.acl.should == subject.s3_access_policy.to_s.gsub("_", "-")
316
+ it "should return the correct s3 access policy" do
317
+ subject.acl.should == (subject.fog_public ? 'public-read' : 'private')
305
318
  end
306
319
  end
307
320
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave_direct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-08 00:00:00.000000000Z
12
+ date: 2012-04-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: carrierwave
16
- requirement: &72575860 !ruby/object:Gem::Requirement
16
+ requirement: &75422450 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *72575860
24
+ version_requirements: *75422450
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: uuid
27
- requirement: &72575510 !ruby/object:Gem::Requirement
27
+ requirement: &75422160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *72575510
35
+ version_requirements: *75422160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fog
38
- requirement: &72575190 !ruby/object:Gem::Requirement
38
+ requirement: &75421880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *72575190
46
+ version_requirements: *75421880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &72574880 !ruby/object:Gem::Requirement
49
+ requirement: &75421510 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *72574880
57
+ version_requirements: *75421510
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: timecop
60
- requirement: &72574590 !ruby/object:Gem::Requirement
60
+ requirement: &75421180 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *72574590
68
+ version_requirements: *75421180
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails
71
- requirement: &72574320 !ruby/object:Gem::Requirement
71
+ requirement: &75420760 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *72574320
79
+ version_requirements: *75420760
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sqlite3
82
- requirement: &72574040 !ruby/object:Gem::Requirement
82
+ requirement: &75420100 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *72574040
90
+ version_requirements: *75420100
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: capybara
93
- requirement: &72573710 !ruby/object:Gem::Requirement
93
+ requirement: &75419660 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *72573710
101
+ version_requirements: *75419660
102
102
  description: Process your uploads in the background by uploading directly to S3
103
103
  email:
104
104
  - dwilkie@gmail.com
@@ -156,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  segments:
158
158
  - 0
159
- hash: 386717071
159
+ hash: 300511313
160
160
  required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  segments:
167
167
  - 0
168
- hash: 386717071
168
+ hash: 300511313
169
169
  requirements: []
170
170
  rubyforge_project: carrierwave_direct
171
171
  rubygems_version: 1.8.10