Skip to content
This repository
Browse code

remove initial slash from existing paths. References #74

  • Loading branch information...
commit 6bf18af83744a316deaea3f581c8bb53730a8f91 1 parent 15d8838
Enrique García authored April 04, 2013
2  lib/carrierwave_direct/uploader.rb
@@ -42,7 +42,7 @@ def key=(k)
42 42
     def key
43 43
       return @key if @key.present?
44 44
       if url.present?
45  
-        self.key = URI.parse(URI.encode(url)).path # explicitly set key
  45
+        self.key = URI.parse(URI.encode(url)).path[1 .. -1] # explicitly set key
46 46
       else
47 47
         @key = "#{store_dir}/#{guid}/#{FILENAME_WILDCARD}"
48 48
       end
8  spec/uploader_spec.rb
@@ -123,12 +123,12 @@
123 123
           mounted_subject.stub(:url).and_return(sample(:s3_file_url))
124 124
         end
125 125
 
126  
-        it "should return '/#{sample(:s3_key)}'" do
127  
-          mounted_subject.key.should == "/#{sample(:s3_key)}"
  126
+        it "should return '#{sample(:s3_key)}'" do
  127
+          mounted_subject.key.should == sample(:s3_key)
128 128
         end
129 129
 
130 130
         it "should set the key explicitly in order to update the version keys" do
131  
-          mounted_subject.should_receive("key=").with("/#{sample(:s3_key)}")
  131
+          mounted_subject.should_receive("key=").with(sample(:s3_key))
132 132
           mounted_subject.key
133 133
         end
134 134
       end
@@ -434,7 +434,7 @@ def have_condition(field, value = nil)
434 434
           subject.success_action_redirect = "http://example.com/some_url"
435 435
           conditions.should have_condition("success_action_redirect" => "http://example.com/some_url")
436 436
         end
437  
-        
  437
+
438 438
         it "'content-type' only if enabled" do
439 439
           conditions.should have_condition('Content-Type') if subject.class.will_include_content_type
440 440
         end

0 notes on commit 6bf18af

Please sign in to comment.
Something went wrong with that request. Please try again.