dsturnbull-carrierwave 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/carrierwave/uploader/cache.rb +2 -6
- data/lib/carrierwave.rb +1 -1
- data/spec/uploader/cache_spec.rb +0 -12
- metadata +1 -1
@@ -125,7 +125,8 @@ module CarrierWave
|
|
125
125
|
File.expand_path(File.join(cache_dir, cache_name), root)
|
126
126
|
end
|
127
127
|
|
128
|
-
attr_reader
|
128
|
+
attr_reader :cache_id
|
129
|
+
attr_accessor :original_filename
|
129
130
|
|
130
131
|
# We can override the full_original_filename method in other modules
|
131
132
|
alias_method :full_original_filename, :original_filename
|
@@ -135,11 +136,6 @@ module CarrierWave
|
|
135
136
|
@cache_id = cache_id
|
136
137
|
end
|
137
138
|
|
138
|
-
def original_filename=(filename)
|
139
|
-
raise CarrierWave::InvalidParameter, "invalid filename" unless filename =~ /\A[a-z0-9\.\-\+_]+\z/i
|
140
|
-
@original_filename = filename
|
141
|
-
end
|
142
|
-
|
143
139
|
end # Cache
|
144
140
|
end # Uploader
|
145
141
|
end # CarrierWave
|
data/lib/carrierwave.rb
CHANGED
data/spec/uploader/cache_spec.rb
CHANGED
@@ -152,18 +152,6 @@ describe CarrierWave::Uploader do
|
|
152
152
|
@uploader.cache_name.should be_nil
|
153
153
|
end
|
154
154
|
|
155
|
-
it "should raise an error when the original_filename contains invalid characters" do
|
156
|
-
running {
|
157
|
-
@uploader.retrieve_from_cache!('20071201-1234-345-2255/te/st.jpeg')
|
158
|
-
}.should raise_error(CarrierWave::InvalidParameter)
|
159
|
-
running {
|
160
|
-
@uploader.retrieve_from_cache!('20071201-1234-345-2255/te??%st.jpeg')
|
161
|
-
}.should raise_error(CarrierWave::InvalidParameter)
|
162
|
-
|
163
|
-
@uploader.file.should be_nil
|
164
|
-
@uploader.filename.should be_nil
|
165
|
-
@uploader.cache_name.should be_nil
|
166
|
-
end
|
167
155
|
end
|
168
156
|
|
169
157
|
describe 'with an overridden, reversing, filename' do
|