dragonfly 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dragonfly might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/dragonfly-rails.gemspec +1 -1
- data/dragonfly.gemspec +1 -1
- data/lib/dragonfly/active_record_extensions/attachment.rb +1 -1
- data/lib/dragonfly/app.rb +1 -1
- data/lib/dragonfly/data_storage/file_data_store.rb +3 -2
- data/lib/dragonfly/url_handler.rb +1 -0
- data/spec/dragonfly/active_record_extensions/migration.rb +1 -0
- data/spec/dragonfly/active_record_extensions/model_spec.rb +7 -0
- data/spec/dragonfly/url_handler_spec.rb +6 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/dragonfly-rails.gemspec
CHANGED
data/dragonfly.gemspec
CHANGED
@@ -97,7 +97,7 @@ module Dragonfly
|
|
97
97
|
def magic_attributes
|
98
98
|
parent_model.class.column_names.select { |name|
|
99
99
|
name =~ /^#{attribute_name}_(.+)$/ &&
|
100
|
-
(analyser.has_analysis_method?($1) || %w(size ext).include?($1))
|
100
|
+
(analyser.has_analysis_method?($1) || %w(size name ext).include?($1))
|
101
101
|
}
|
102
102
|
end
|
103
103
|
|
data/lib/dragonfly/app.rb
CHANGED
@@ -100,7 +100,7 @@ module Dragonfly
|
|
100
100
|
include Configurable
|
101
101
|
|
102
102
|
configurable_attr :datastore do DataStorage::FileDataStore.new end
|
103
|
-
configurable_attr :encoder do Encoding::
|
103
|
+
configurable_attr :encoder do Encoding::TransparentEncoder.new end
|
104
104
|
configurable_attr :log do Logger.new('/var/tmp/dragonfly.log') end
|
105
105
|
configurable_attr :cache_duration, 3600*24*365 # Defaults to 1 year
|
106
106
|
configurable_attr :fallback_mime_type, 'application/octet-stream'
|
@@ -30,8 +30,9 @@ module Dragonfly
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def retrieve(uid)
|
33
|
-
|
34
|
-
|
33
|
+
pattern = "#{absolute_storage_path(uid)}*"
|
34
|
+
entries = Dir[pattern]
|
35
|
+
raise DataNotFound, "Couldn't find any files matching #{pattern}" if entries.empty?
|
35
36
|
File.new(entries.first)
|
36
37
|
rescue Errno::ENOENT => e
|
37
38
|
raise DataNotFound, e.message
|
@@ -6,6 +6,7 @@ class MigrationForTest < ActiveRecord::Migration
|
|
6
6
|
t.string :preview_image_uid
|
7
7
|
t.string :preview_image_some_analyser_method
|
8
8
|
t.integer :preview_image_size
|
9
|
+
t.string :preview_image_name
|
9
10
|
t.string :preview_image_ext
|
10
11
|
t.string :preview_image_blah_blah
|
11
12
|
t.string :other_image_uid
|
@@ -401,6 +401,13 @@ describe Item do
|
|
401
401
|
@item.preview_image = data
|
402
402
|
@item.preview_image_ext.should == 'png'
|
403
403
|
end
|
404
|
+
|
405
|
+
it "should store the original file name if it exists" do
|
406
|
+
data = 'jasdlkf sadjl'
|
407
|
+
data.stub!(:original_filename).and_return('hello.png')
|
408
|
+
@item.preview_image = data
|
409
|
+
@item.preview_image_name.should == 'hello.png'
|
410
|
+
end
|
404
411
|
|
405
412
|
end
|
406
413
|
|
@@ -91,6 +91,12 @@ describe Dragonfly::UrlHandler do
|
|
91
91
|
parameters.format.should == 'bean'
|
92
92
|
end
|
93
93
|
|
94
|
+
it "should unescape any url-escaped characters" do
|
95
|
+
parameters = @url_handler.url_to_parameters('hello%20bean.jpg', 'm=whats%20up')
|
96
|
+
parameters.uid.should == 'hello bean'
|
97
|
+
parameters.processing_method.should == 'whats up'
|
98
|
+
end
|
99
|
+
|
94
100
|
end
|
95
101
|
|
96
102
|
describe "forming a url from parameters" do
|