dragonfly 0.9.14 → 0.9.15

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

Potentially problematic release.


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

@@ -0,0 +1,16 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ **.sqlite3
5
+ pkg
6
+ .yardoc
7
+ doc
8
+ fixtures/*/tmp_app
9
+ .ginger
10
+ .bundle
11
+ .rvmrc
12
+ spec/spec.log
13
+ Gemfile.lock
14
+ .s3_spec.yml
15
+ ***.rbc
16
+ spec/support/tmp.rb
data/Gemfile CHANGED
@@ -1,32 +1,2 @@
1
- source :rubygems
2
-
3
- gem "rack"
4
- gem "multi_json", "~> 1.0"
5
-
6
- # These gems are needed for development and testing
7
- group :development, :test, :cucumber do
8
- gem 'capybara'
9
- gem 'cucumber', '~>1.2.1'
10
- gem 'cucumber-rails', "~> 1.3.0"
11
- gem 'database_cleaner'
12
- gem 'jeweler', '>= 1.5.2'
13
- gem 'fog'
14
- gem 'github-markup'
15
- gem 'mongo'
16
- gem 'couchrest', '~> 1.0'
17
- gem 'rack-cache'
18
- gem 'rails', '~>3.2.0', :require => nil
19
- gem 'rspec', '~> 2.5'
20
- gem 'webmock'
21
- gem 'yard'
22
- if RUBY_PLATFORM == "java"
23
- gem "jdbc-sqlite3"
24
- gem "activerecord-jdbcsqlite3-adapter"
25
- gem "jruby-openssl"
26
- else
27
- gem 'redcarpet', '~>1.0'
28
- gem 'bluecloth'
29
- gem 'bson_ext'
30
- gem 'sqlite3'
31
- end
32
- end
1
+ source 'https://rubygems.org'
2
+ gemspec
data/History.md CHANGED
@@ -1,3 +1,14 @@
1
+ 0.9.15 (2013-05-04)
2
+ ===================
3
+ Features
4
+ --------
5
+ - Allow turning off support of legacy urls
6
+
7
+ Fixes
8
+ -----
9
+ - More conservative URL escaping - back to Rack::Utils.escape_path
10
+ - Don't check for malicious strings when deserializing from datastores (they're to be trusted)
11
+
1
12
  0.9.14 (2013-02-13)
2
13
  ===================
3
14
  Features
data/README.md CHANGED
@@ -7,13 +7,15 @@ Ideal for using with Ruby on Rails (2.3 and 3), Sinatra and all that gubbins.
7
7
 
8
8
  However, Dragonfly is NOT JUST FOR RAILS, and NOT JUST FOR IMAGES!!
9
9
 
10
+ **IMPORTANT: if you're running a version between 0.7.0 and 0.9.12, please update to at least 0.9.14 for a security update [details here](https://groups.google.com/forum/?fromgroups=#!topic/dragonfly-users/3c3WIU3VQTo)**
11
+
10
12
  For the lazy Rails user...
11
13
  --------------------------
12
14
  **Gemfile**:
13
15
 
14
16
  ```ruby
15
17
  gem 'rack-cache', :require => 'rack/cache'
16
- gem 'dragonfly', '~>0.9.14'
18
+ gem 'dragonfly', '~>0.9.15'
17
19
  ```
18
20
 
19
21
  **Initializer** (e.g. config/initializers/dragonfly.rb):
@@ -55,25 +57,25 @@ NB: REMEMBER THE MULTIPART BIT!!!
55
57
  You can avoid having to re-upload when validations fail with
56
58
 
57
59
  ```erb
58
- <%= f.hidden_field :retained_cover_image %>
60
+ <%= f.hidden_field :retained_cover_image %>
59
61
  ```
60
62
 
61
63
  remove the attachment with
62
64
 
63
65
  ```erb
64
- <%= f.check_box :remove_cover_image %>
66
+ <%= f.check_box :remove_cover_image %>
65
67
  ```
66
68
 
67
69
  assign from some other url with
68
70
 
69
71
  ```erb
70
- <%= f.text_field :cover_image_url %>
72
+ <%= f.text_field :cover_image_url %>
71
73
  ```
72
74
 
73
75
  and display a thumbnail (on the upload form) with
74
76
 
75
77
  ```erb
76
- <%= image_tag @album.cover_image.thumb('100x100').url if @album.cover_image_uid %>
78
+ <%= image_tag @album.cover_image.thumb('100x100').url if @album.cover_image_uid %>
77
79
  ```
78
80
 
79
81
  **View** (to display):
data/Rakefile CHANGED
@@ -9,19 +9,6 @@ rescue Bundler::BundlerError => e
9
9
  end
10
10
  require 'rake'
11
11
 
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- gem.name = "dragonfly"
15
- gem.email = "mark@new-bamboo.co.uk"
16
- gem.summary = %Q{Ideal gem for handling attachments in Rails, Sinatra and Rack applications.}
17
- gem.description = %Q{Dragonfly is a framework that enables on-the-fly processing for any content type.
18
- It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation.}
19
- gem.homepage = "http://github.com/markevans/dragonfly"
20
- gem.license = "MIT"
21
- gem.authors = ["Mark Evans"]
22
- end
23
- Jeweler::RubygemsDotOrgTasks.new
24
-
25
12
  require 'rspec/core'
26
13
  require 'rspec/core/rake_task'
27
14
  RSpec::Core::RakeTask.new(:spec) do |spec|
@@ -1,270 +1,51 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dragonfly/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = "dragonfly"
8
- s.version = "0.9.14"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Mark Evans"]
12
- s.date = "2013-02-13"
13
- s.description = "Dragonfly is a framework that enables on-the-fly processing for any content type.\n It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation."
14
- s.email = "mark@new-bamboo.co.uk"
15
- s.extra_rdoc_files = [
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dragonfly"
8
+ spec.version = Dragonfly::VERSION
9
+ spec.authors = ["Mark Evans"]
10
+ spec.email = "mark@new-bamboo.co.uk"
11
+ spec.description = "Dragonfly is a framework that enables on-the-fly processing for any content type.\n It is especially suited to image handling. Its uses range from image thumbnails to standard attachments to on-demand text generation."
12
+ spec.summary = "Ideal gem for handling attachments in Rails, Sinatra and Rack applications."
13
+ spec.homepage = "http://github.com/markevans/dragonfly"
14
+ spec.license = "MIT"
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+ spec.extra_rdoc_files = [
16
20
  "LICENSE",
17
21
  "README.md"
18
22
  ]
19
- s.files = [
20
- ".rspec",
21
- ".yardopts",
22
- "Gemfile",
23
- "History.md",
24
- "LICENSE",
25
- "README.md",
26
- "Rakefile",
27
- "VERSION",
28
- "config.ru",
29
- "docs.watchr",
30
- "dragonfly.gemspec",
31
- "extra_docs/Analysers.md",
32
- "extra_docs/Caching.md",
33
- "extra_docs/Configuration.md",
34
- "extra_docs/Couch.md",
35
- "extra_docs/DataStorage.md",
36
- "extra_docs/Encoding.md",
37
- "extra_docs/ExampleUseCases.md",
38
- "extra_docs/GeneralUsage.md",
39
- "extra_docs/Generators.md",
40
- "extra_docs/Heroku.md",
41
- "extra_docs/ImageMagick.md",
42
- "extra_docs/Index.md",
43
- "extra_docs/MimeTypes.md",
44
- "extra_docs/Models.md",
45
- "extra_docs/Mongo.md",
46
- "extra_docs/Processing.md",
47
- "extra_docs/Rack.md",
48
- "extra_docs/Rails2.md",
49
- "extra_docs/Rails3.md",
50
- "extra_docs/ServingRemotely.md",
51
- "extra_docs/Sinatra.md",
52
- "extra_docs/URLs.md",
53
- "features/images.feature",
54
- "features/no_processing.feature",
55
- "features/rails.feature",
56
- "features/steps/common_steps.rb",
57
- "features/steps/dragonfly_steps.rb",
58
- "features/steps/rails_steps.rb",
59
- "features/support/env.rb",
60
- "features/support/setup.rb",
61
- "fixtures/rails/files/app/models/album.rb",
62
- "fixtures/rails/files/app/views/albums/new.html.erb",
63
- "fixtures/rails/files/app/views/albums/show.html.erb",
64
- "fixtures/rails/files/config/initializers/dragonfly.rb",
65
- "fixtures/rails/files/features/manage_album_images.feature",
66
- "fixtures/rails/files/features/step_definitions/helper_steps.rb",
67
- "fixtures/rails/files/features/step_definitions/image_steps.rb",
68
- "fixtures/rails/files/features/step_definitions/web_steps.rb",
69
- "fixtures/rails/files/features/support/paths.rb",
70
- "fixtures/rails/files/features/text_images.feature",
71
- "fixtures/rails/template.rb",
72
- "irbrc.rb",
73
- "lib/dragonfly.rb",
74
- "lib/dragonfly/active_model_extensions.rb",
75
- "lib/dragonfly/active_model_extensions/attachment.rb",
76
- "lib/dragonfly/active_model_extensions/attachment_class_methods.rb",
77
- "lib/dragonfly/active_model_extensions/class_methods.rb",
78
- "lib/dragonfly/active_model_extensions/instance_methods.rb",
79
- "lib/dragonfly/active_model_extensions/validations.rb",
80
- "lib/dragonfly/analyser.rb",
81
- "lib/dragonfly/analysis/file_command_analyser.rb",
82
- "lib/dragonfly/analysis/image_magick_analyser.rb",
83
- "lib/dragonfly/app.rb",
84
- "lib/dragonfly/config/heroku.rb",
85
- "lib/dragonfly/config/image_magick.rb",
86
- "lib/dragonfly/config/rails.rb",
87
- "lib/dragonfly/configurable.rb",
88
- "lib/dragonfly/cookie_monster.rb",
89
- "lib/dragonfly/core_ext/array.rb",
90
- "lib/dragonfly/core_ext/hash.rb",
91
- "lib/dragonfly/core_ext/object.rb",
92
- "lib/dragonfly/data_storage.rb",
93
- "lib/dragonfly/data_storage/couch_data_store.rb",
94
- "lib/dragonfly/data_storage/file_data_store.rb",
95
- "lib/dragonfly/data_storage/mongo_data_store.rb",
96
- "lib/dragonfly/data_storage/s3data_store.rb",
97
- "lib/dragonfly/encoder.rb",
98
- "lib/dragonfly/encoding/image_magick_encoder.rb",
99
- "lib/dragonfly/function_manager.rb",
100
- "lib/dragonfly/generation/image_magick_generator.rb",
101
- "lib/dragonfly/generator.rb",
102
- "lib/dragonfly/has_filename.rb",
103
- "lib/dragonfly/hash_with_css_style_keys.rb",
104
- "lib/dragonfly/image_magick/analyser.rb",
105
- "lib/dragonfly/image_magick/config.rb",
106
- "lib/dragonfly/image_magick/encoder.rb",
107
- "lib/dragonfly/image_magick/generator.rb",
108
- "lib/dragonfly/image_magick/processor.rb",
109
- "lib/dragonfly/image_magick/utils.rb",
110
- "lib/dragonfly/image_magick_utils.rb",
111
- "lib/dragonfly/job.rb",
112
- "lib/dragonfly/job_builder.rb",
113
- "lib/dragonfly/job_definitions.rb",
114
- "lib/dragonfly/job_endpoint.rb",
115
- "lib/dragonfly/loggable.rb",
116
- "lib/dragonfly/middleware.rb",
117
- "lib/dragonfly/processing/image_magick_processor.rb",
118
- "lib/dragonfly/processor.rb",
119
- "lib/dragonfly/rails/images.rb",
120
- "lib/dragonfly/railtie.rb",
121
- "lib/dragonfly/response.rb",
122
- "lib/dragonfly/routed_endpoint.rb",
123
- "lib/dragonfly/serializer.rb",
124
- "lib/dragonfly/server.rb",
125
- "lib/dragonfly/shell.rb",
126
- "lib/dragonfly/simple_cache.rb",
127
- "lib/dragonfly/temp_object.rb",
128
- "lib/dragonfly/url_attributes.rb",
129
- "lib/dragonfly/url_mapper.rb",
130
- "lib/dragonfly/utils.rb",
131
- "samples/DSC02119.JPG",
132
- "samples/a.jp2",
133
- "samples/beach.jpg",
134
- "samples/beach.png",
135
- "samples/egg.png",
136
- "samples/round.gif",
137
- "samples/sample.docx",
138
- "samples/taj.jpg",
139
- "samples/white pixel.png",
140
- "spec/dragonfly/active_model_extensions/model_spec.rb",
141
- "spec/dragonfly/active_model_extensions/spec_helper.rb",
142
- "spec/dragonfly/analyser_spec.rb",
143
- "spec/dragonfly/analysis/file_command_analyser_spec.rb",
144
- "spec/dragonfly/app_spec.rb",
145
- "spec/dragonfly/configurable_spec.rb",
146
- "spec/dragonfly/cookie_monster_spec.rb",
147
- "spec/dragonfly/core_ext/array_spec.rb",
148
- "spec/dragonfly/core_ext/hash_spec.rb",
149
- "spec/dragonfly/data_storage/couch_data_store_spec.rb",
150
- "spec/dragonfly/data_storage/file_data_store_spec.rb",
151
- "spec/dragonfly/data_storage/mongo_data_store_spec.rb",
152
- "spec/dragonfly/data_storage/s3_data_store_spec.rb",
153
- "spec/dragonfly/data_storage/shared_data_store_examples.rb",
154
- "spec/dragonfly/function_manager_spec.rb",
155
- "spec/dragonfly/has_filename_spec.rb",
156
- "spec/dragonfly/hash_with_css_style_keys_spec.rb",
157
- "spec/dragonfly/image_magick/analyser_spec.rb",
158
- "spec/dragonfly/image_magick/encoder_spec.rb",
159
- "spec/dragonfly/image_magick/generator_spec.rb",
160
- "spec/dragonfly/image_magick/processor_spec.rb",
161
- "spec/dragonfly/job_builder_spec.rb",
162
- "spec/dragonfly/job_definitions_spec.rb",
163
- "spec/dragonfly/job_endpoint_spec.rb",
164
- "spec/dragonfly/job_spec.rb",
165
- "spec/dragonfly/loggable_spec.rb",
166
- "spec/dragonfly/middleware_spec.rb",
167
- "spec/dragonfly/routed_endpoint_spec.rb",
168
- "spec/dragonfly/serializer_spec.rb",
169
- "spec/dragonfly/server_spec.rb",
170
- "spec/dragonfly/shell_spec.rb",
171
- "spec/dragonfly/simple_cache_spec.rb",
172
- "spec/dragonfly/temp_object_spec.rb",
173
- "spec/dragonfly/url_attributes.rb",
174
- "spec/dragonfly/url_mapper_spec.rb",
175
- "spec/functional/deprecations_spec.rb",
176
- "spec/functional/image_magick_app_spec.rb",
177
- "spec/functional/model_urls_spec.rb",
178
- "spec/functional/remote_on_the_fly_spec.rb",
179
- "spec/functional/shell_commands_spec.rb",
180
- "spec/functional/to_response_spec.rb",
181
- "spec/functional/urls_spec.rb",
182
- "spec/spec_helper.rb",
183
- "spec/support/argument_matchers.rb",
184
- "spec/support/image_matchers.rb",
185
- "spec/support/simple_matchers.rb",
186
- "spec/test_imagemagick.ru",
187
- "tmp/.gitignore",
188
- "yard/handlers/configurable_attr_handler.rb",
189
- "yard/setup.rb",
190
- "yard/templates/default/fulldoc/html/css/common.css",
191
- "yard/templates/default/layout/html/layout.erb",
192
- "yard/templates/default/module/html/configuration_summary.erb",
193
- "yard/templates/default/module/setup.rb"
194
- ]
195
- s.homepage = "http://github.com/markevans/dragonfly"
196
- s.licenses = ["MIT"]
197
- s.require_paths = ["lib"]
198
- s.rubygems_version = "1.8.24"
199
- s.summary = "Ideal gem for handling attachments in Rails, Sinatra and Rack applications."
200
23
 
201
- if s.respond_to? :specification_version then
202
- s.specification_version = 3
24
+ spec.add_runtime_dependency("rack", [">= 0"])
25
+ spec.add_runtime_dependency("multi_json", ["~> 1.0"])
203
26
 
204
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
205
- s.add_runtime_dependency(%q<rack>, [">= 0"])
206
- s.add_runtime_dependency(%q<multi_json>, ["~> 1.0"])
207
- s.add_development_dependency(%q<capybara>, [">= 0"])
208
- s.add_development_dependency(%q<cucumber>, ["~> 1.2.1"])
209
- s.add_development_dependency(%q<cucumber-rails>, ["~> 1.3.0"])
210
- s.add_development_dependency(%q<database_cleaner>, [">= 0"])
211
- s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
212
- s.add_development_dependency(%q<fog>, [">= 0"])
213
- s.add_development_dependency(%q<github-markup>, [">= 0"])
214
- s.add_development_dependency(%q<mongo>, [">= 0"])
215
- s.add_development_dependency(%q<couchrest>, ["~> 1.0"])
216
- s.add_development_dependency(%q<rack-cache>, [">= 0"])
217
- s.add_development_dependency(%q<rails>, ["~> 3.2.0"])
218
- s.add_development_dependency(%q<rspec>, ["~> 2.5"])
219
- s.add_development_dependency(%q<webmock>, [">= 0"])
220
- s.add_development_dependency(%q<yard>, [">= 0"])
221
- s.add_development_dependency(%q<redcarpet>, ["~> 1.0"])
222
- s.add_development_dependency(%q<bluecloth>, [">= 0"])
223
- s.add_development_dependency(%q<bson_ext>, [">= 0"])
224
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
225
- else
226
- s.add_dependency(%q<rack>, [">= 0"])
227
- s.add_dependency(%q<multi_json>, ["~> 1.0"])
228
- s.add_dependency(%q<capybara>, [">= 0"])
229
- s.add_dependency(%q<cucumber>, ["~> 1.2.1"])
230
- s.add_dependency(%q<cucumber-rails>, ["~> 1.3.0"])
231
- s.add_dependency(%q<database_cleaner>, [">= 0"])
232
- s.add_dependency(%q<jeweler>, [">= 1.5.2"])
233
- s.add_dependency(%q<fog>, [">= 0"])
234
- s.add_dependency(%q<github-markup>, [">= 0"])
235
- s.add_dependency(%q<mongo>, [">= 0"])
236
- s.add_dependency(%q<couchrest>, ["~> 1.0"])
237
- s.add_dependency(%q<rack-cache>, [">= 0"])
238
- s.add_dependency(%q<rails>, ["~> 3.2.0"])
239
- s.add_dependency(%q<rspec>, ["~> 2.5"])
240
- s.add_dependency(%q<webmock>, [">= 0"])
241
- s.add_dependency(%q<yard>, [">= 0"])
242
- s.add_dependency(%q<redcarpet>, ["~> 1.0"])
243
- s.add_dependency(%q<bluecloth>, [">= 0"])
244
- s.add_dependency(%q<bson_ext>, [">= 0"])
245
- s.add_dependency(%q<sqlite3>, [">= 0"])
246
- end
27
+ spec.add_development_dependency("capybara", [">= 0"])
28
+ spec.add_development_dependency("cucumber", ["~> 1.2.1"])
29
+ spec.add_development_dependency("cucumber-rails", ["~> 1.3.0"])
30
+ spec.add_development_dependency("database_cleaner", [">= 0"])
31
+ spec.add_development_dependency("fog", [">= 0"])
32
+ spec.add_development_dependency("github-markup", [">= 0"])
33
+ spec.add_development_dependency("mongo", [">= 0"])
34
+ spec.add_development_dependency("couchrest", ["~> 1.0"])
35
+ spec.add_development_dependency("rack-cache", [">= 0"])
36
+ spec.add_development_dependency("rails", ["~> 3.2.0"])
37
+ spec.add_development_dependency("rspec", ["~> 2.5"])
38
+ spec.add_development_dependency("webmock", [">= 0"])
39
+ spec.add_development_dependency("yard", [">= 0"])
40
+ if RUBY_PLATFORM == "java"
41
+ spec.add_development_dependency("jdbc-sqlite3", [">= 0"])
42
+ spec.add_development_dependency("activerecord-jdbcsqlite3-adapter", [">= 0"])
43
+ spec.add_development_dependency("jruby-openssl", [">= 0"])
247
44
  else
248
- s.add_dependency(%q<rack>, [">= 0"])
249
- s.add_dependency(%q<multi_json>, ["~> 1.0"])
250
- s.add_dependency(%q<capybara>, [">= 0"])
251
- s.add_dependency(%q<cucumber>, ["~> 1.2.1"])
252
- s.add_dependency(%q<cucumber-rails>, ["~> 1.3.0"])
253
- s.add_dependency(%q<database_cleaner>, [">= 0"])
254
- s.add_dependency(%q<jeweler>, [">= 1.5.2"])
255
- s.add_dependency(%q<fog>, [">= 0"])
256
- s.add_dependency(%q<github-markup>, [">= 0"])
257
- s.add_dependency(%q<mongo>, [">= 0"])
258
- s.add_dependency(%q<couchrest>, ["~> 1.0"])
259
- s.add_dependency(%q<rack-cache>, [">= 0"])
260
- s.add_dependency(%q<rails>, ["~> 3.2.0"])
261
- s.add_dependency(%q<rspec>, ["~> 2.5"])
262
- s.add_dependency(%q<webmock>, [">= 0"])
263
- s.add_dependency(%q<yard>, [">= 0"])
264
- s.add_dependency(%q<redcarpet>, ["~> 1.0"])
265
- s.add_dependency(%q<bluecloth>, [">= 0"])
266
- s.add_dependency(%q<bson_ext>, [">= 0"])
267
- s.add_dependency(%q<sqlite3>, [">= 0"])
45
+ spec.add_development_dependency("redcarpet", ["~> 1.0"])
46
+ spec.add_development_dependency("bluecloth", [">= 0"])
47
+ spec.add_development_dependency("bson_ext", [">= 0"])
48
+ spec.add_development_dependency("sqlite3", [">= 0"])
268
49
  end
269
- end
270
50
 
51
+ end
@@ -6,7 +6,7 @@ the image is processed, and there might be a short delay and getting the respons
6
6
 
7
7
  However, dragonfly apps send `Cache-Control` and `ETag` headers in the response, so we can easily put a caching
8
8
  proxy like {http://varnish.projects.linpro.no Varnish}, {http://www.squid-cache.org Squid},
9
- {http://tomayko.com/src/rack-cache/ Rack::Cache}, etc. in front of the app, so that subsequent requests are served
9
+ {http://rtomayko.github.com/rack-cache/ Rack::Cache}, etc. in front of the app, so that subsequent requests are served
10
10
  super-quickly straight out of the cache.
11
11
 
12
12
  The file 'dragonfly/rails/images' puts Rack::Cache in front of Dragonfly by default, but for better performance
@@ -1,12 +1,7 @@
1
1
  Heroku
2
2
  ======
3
3
 
4
- The default configuration won't work out of the box for Heroku, because
5
-
6
- - Heroku doesn't allow saving files to the filesystem (although it does use tempfiles)
7
- - If on Heroku {http://devcenter.heroku.com/articles/stack Aspen/Bamboo stacks}, we won't need {http://tomayko.com/src/rack-cache/ Rack::Cache},
8
- because it already uses the caching proxy {http://varnish.projects.linpro.no/ Varnish}, which we can make use of.
9
- We will still need it on {http://devcenter.heroku.com/articles/cedar Heroku Cedar}, however, as it doesn't include Varnish.
4
+ The default configuration won't work out of the box for Heroku, because the platform doesn't allow saving files to the filesystem (although it does use tempfiles).
10
5
 
11
6
  Instead of the normal {file:DataStorage#File\_datastore FileDataStore}, we can use the {file:DataStorage#S3\_datastore S3DataStore}.
12
7
 
@@ -51,7 +46,5 @@ From your app's directory:
51
46
 
52
47
  Replace 'XXXXXXXXX' with your access key and secret.
53
48
 
54
- **NOTE**: HEROKU'S VARNISH CACHE IS CLEARED EVERY TIME YOU DEPLOY!!! (DOESN'T APPLY TO CEDAR STACK)
55
-
56
49
  If this is an issue, you may want to look into storing thumbnails on S3 (see {file:ServingRemotely}), or maybe generating thumbnails _on upload_ (see {file:Models#Up-front_thumbnailing}), or maybe an after-deploy hook for hitting specific Dragonfly urls you want to cache, etc.
57
50
  It won't be a problem for most sites though.
@@ -35,7 +35,7 @@ application.rb:
35
35
  Gemfile
36
36
  -------
37
37
 
38
- gem 'dragonfly', '~>0.9.14'
38
+ gem 'dragonfly', '~>0.9.15'
39
39
  gem 'rack-cache', :require => 'rack/cache'
40
40
 
41
41
  Capistrano
@@ -31,6 +31,7 @@ end
31
31
 
32
32
  autoload_files_in_dir["#{File.dirname(__FILE__)}/dragonfly", 'Dragonfly']
33
33
 
34
+ require 'dragonfly/version'
34
35
  require 'dragonfly/core_ext/object'
35
36
  require 'dragonfly/core_ext/array'
36
37
  require 'dragonfly/core_ext/hash'
@@ -52,6 +52,7 @@ module Dragonfly
52
52
  configurable_attr :trust_file_extensions, true
53
53
  configurable_attr :content_disposition
54
54
  configurable_attr :content_filename, Dragonfly::Response::DEFAULT_FILENAME
55
+ configurable_attr :allow_legacy_urls, true
55
56
 
56
57
  attr_reader :analyser
57
58
  attr_reader :processor
@@ -175,7 +175,11 @@ module Dragonfly
175
175
  array = begin
176
176
  Serializer.json_decode(string)
177
177
  rescue Serializer::BadString
178
- Serializer.marshal_decode(string) # legacy strings
178
+ if app.allow_legacy_urls
179
+ Serializer.marshal_decode(string, :check_malicious => true) # legacy strings
180
+ else
181
+ raise
182
+ end
179
183
  end
180
184
  from_a(array, app)
181
185
  end
@@ -25,9 +25,9 @@ module Dragonfly
25
25
  b64_encode(Marshal.dump(object))
26
26
  end
27
27
 
28
- def marshal_decode(string)
28
+ def marshal_decode(string, opts={})
29
29
  marshal_string = b64_decode(string)
30
- raise MaliciousString, "potentially malicious marshal string #{marshal_string.inspect}" if marshal_string[/@[a-z_]/i]
30
+ raise MaliciousString, "potentially malicious marshal string #{marshal_string.inspect}" if opts[:check_malicious] && marshal_string[/@[a-z_]/i]
31
31
  Marshal.load(marshal_string)
32
32
  rescue TypeError, ArgumentError => e
33
33
  raise BadString, "couldn't decode #{string} - got #{e}"
@@ -22,7 +22,7 @@ module Dragonfly
22
22
  end
23
23
 
24
24
  def uri_escape_segment(string)
25
- URI.escape(string).sub('/', '%2F')
25
+ Rack::Utils.escape_path(string)
26
26
  end
27
27
 
28
28
  def uri_unescape(string)
@@ -0,0 +1,3 @@
1
+ module Dragonfly
2
+ VERSION = '0.9.15'
3
+ end
@@ -548,10 +548,27 @@ describe Dragonfly::Job do
548
548
  job = Dragonfly::Job.deserialize("W1siZiIsInNvbWVfdWlkIl1d", @app)
549
549
  job.fetch_step.uid.should == 'some_uid'
550
550
  end
551
- it "works with marshal encoded strings (deprecated)" do
552
- job = Dragonfly::Job.deserialize("BAhbBlsHSSIGZgY6BkVUSSINc29tZV91aWQGOwBU", @app)
553
- job.fetch_step.uid.should == 'some_uid'
551
+
552
+ context 'legacy urls are enabled' do
553
+ it "works with marshal encoded strings (deprecated)" do
554
+ job = Dragonfly::Job.deserialize("BAhbBlsHSSIGZgY6BkVUSSINc29tZV91aWQGOwBU", @app)
555
+ job.fetch_step.uid.should == 'some_uid'
556
+ end
557
+
558
+ it "checks for potentially malicious strings" do
559
+ string = Dragonfly::Serializer.marshal_encode(Dragonfly::TempObject.new('a'))
560
+ expect{
561
+ Dragonfly::Job.deserialize(string, @app)
562
+ }.to raise_error(Dragonfly::Serializer::MaliciousString)
563
+ end
554
564
  end
565
+
566
+ context 'legacy urls are disabled' do
567
+ it "rejects marshal encoded strings " do
568
+ @app.allow_legacy_urls = false
569
+ expect {Dragonfly::Job.deserialize("BAhbBlsHSSIGZgY6BkVUSSINc29tZV91aWQGOwBU", @app)}.to raise_error(Dragonfly::Serializer::BadString)
570
+ end
571
+ end
555
572
  end
556
573
 
557
574
  describe "to_app" do
@@ -66,14 +66,18 @@ describe Dragonfly::Serializer do
66
66
  }.should raise_error(Dragonfly::Serializer::BadString)
67
67
  end
68
68
  describe "potentially harmful strings" do
69
+ it "doesn't raise if not flagged to check for malicious strings" do
70
+ class C; end
71
+ marshal_decode('BAhvOgZDBjoOQF9fc2VuZF9faQY').should be_a(C)
72
+ end
69
73
  ['_', 'hello', 'h2', '__send__', 'F'].each do |variable_name|
70
- it "should raise an error if the string passed in is potentially harmful (e.g. contains instance variable #{variable_name})" do
74
+ it "raises if flagged to check for malicious strings and finds one" do
71
75
  class C; end
72
76
  c = C.new
73
77
  c.instance_eval{ instance_variable_set("@#{variable_name}", 1) }
74
78
  string = Dragonfly::Serializer.b64_encode(Marshal.dump(c))
75
79
  lambda{
76
- marshal_decode(string)
80
+ marshal_decode(string, :check_malicious => true)
77
81
  }.should raise_error(Dragonfly::Serializer::MaliciousString)
78
82
  end
79
83
  end
@@ -121,16 +121,6 @@ describe Dragonfly::Server do
121
121
  response.headers['X-Cascade'].should be_nil
122
122
  end
123
123
 
124
- it "should return a 404 when the url is malicious" do
125
- class C; def initialize; @a = 1; end; end
126
- url = "/media/#{Dragonfly::Serializer.marshal_encode(C.new)}"
127
- response = request(@server, url)
128
- response.status.should == 404
129
- response.body.should == 'Not found'
130
- response.content_type.should == 'text/plain'
131
- response.headers['X-Cascade'].should be_nil
132
- end
133
-
134
124
  it "should return a 403 Forbidden when someone uses fetch_file" do
135
125
  response = request(@server, "/media/#{@app.fetch_file('/some/file.txt').serialize}")
136
126
  response.status.should == 403
@@ -122,7 +122,7 @@ describe Dragonfly::UrlMapper do
122
122
  '/media/asdf.egg' => {'job' => 'asdf', 'basename' => nil, 'format' => 'egg'},
123
123
  '/media/asdf/stuff/egg' => nil,
124
124
  '/media/asdf/stuff.dog.egg' => {'job' => 'asdf', 'basename' => 'stuff.dog', 'format' => 'egg'},
125
- '/media/asdf/s=2+-.d.e' => {'job' => 'asdf', 'basename' => 's=2+-.d', 'format' => 'e'},
125
+ '/media/asdf/s%3D2%2B-.d.e' => {'job' => 'asdf', 'basename' => 's=2+-.d', 'format' => 'e'},
126
126
  '/media/asdf-40x40/stuff.egg' => nil,
127
127
  '/media/a%23c' => {'job' => 'a#c', 'basename' => nil, 'format' => nil}
128
128
  }.each do |path, params|
@@ -21,8 +21,8 @@ describe "urls" do
21
21
  end
22
22
 
23
23
  it "blows up if it detects bad objects" do
24
- url = "/BAhvOgZDBjoLQHRoaW5nSSIId2VlBjoGRVQ"
25
- Dragonfly::Response.should_not_receive(:new)
24
+ url = "/BAhvOhpEcmFnb25mbHk6OlRlbXBPYmplY3QIOgpAZGF0YUkiCWJsYWgGOgZFVDoXQG9yaWdpbmFsX2ZpbGVuYW1lMDoKQG1ldGF7AA"
25
+ Dragonfly::Job.should_not_receive(:from_a)
26
26
  response = request(app, url)
27
27
  response.status.should == 404
28
28
  end
@@ -38,4 +38,11 @@ describe "urls" do
38
38
  job_should_match [["f", "2012/11/03/17_38_08_578__MG_5899_.jpg"], ["p", "thumb", "450x450>"]]
39
39
  response = request(app, url)
40
40
  end
41
+
42
+ it "works with potentially tricky url characters for the url" do
43
+ url = app.fetch('uid []=~/+').url(:basename => 'name []=~/+')
44
+ url.should =~ %r(^/[\w%]+/name%20%5B%5D%3D%7E%2F%2B$)
45
+ job_should_match [["f", "uid []=~/+"]]
46
+ response = request(app, url)
47
+ end
41
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
12
+ date: 2013-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -107,22 +107,6 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: jeweler
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: 1.5.2
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: 1.5.2
126
110
  - !ruby/object:Gem::Dependency
127
111
  name: fog
128
112
  requirement: !ruby/object:Gem::Requirement
@@ -341,6 +325,7 @@ extra_rdoc_files:
341
325
  - LICENSE
342
326
  - README.md
343
327
  files:
328
+ - .gitignore
344
329
  - .rspec
345
330
  - .yardopts
346
331
  - Gemfile
@@ -348,7 +333,6 @@ files:
348
333
  - LICENSE
349
334
  - README.md
350
335
  - Rakefile
351
- - VERSION
352
336
  - config.ru
353
337
  - docs.watchr
354
338
  - dragonfly.gemspec
@@ -452,6 +436,7 @@ files:
452
436
  - lib/dragonfly/url_attributes.rb
453
437
  - lib/dragonfly/url_mapper.rb
454
438
  - lib/dragonfly/utils.rb
439
+ - lib/dragonfly/version.rb
455
440
  - samples/DSC02119.JPG
456
441
  - samples/a.jp2
457
442
  - samples/beach.jpg
@@ -528,9 +513,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
528
513
  - - ! '>='
529
514
  - !ruby/object:Gem::Version
530
515
  version: '0'
531
- segments:
532
- - 0
533
- hash: -1610166145286138499
534
516
  required_rubygems_version: !ruby/object:Gem::Requirement
535
517
  none: false
536
518
  requirements:
@@ -543,4 +525,60 @@ rubygems_version: 1.8.24
543
525
  signing_key:
544
526
  specification_version: 3
545
527
  summary: Ideal gem for handling attachments in Rails, Sinatra and Rack applications.
546
- test_files: []
528
+ test_files:
529
+ - features/images.feature
530
+ - features/no_processing.feature
531
+ - features/rails.feature
532
+ - features/steps/common_steps.rb
533
+ - features/steps/dragonfly_steps.rb
534
+ - features/steps/rails_steps.rb
535
+ - features/support/env.rb
536
+ - features/support/setup.rb
537
+ - spec/dragonfly/active_model_extensions/model_spec.rb
538
+ - spec/dragonfly/active_model_extensions/spec_helper.rb
539
+ - spec/dragonfly/analyser_spec.rb
540
+ - spec/dragonfly/analysis/file_command_analyser_spec.rb
541
+ - spec/dragonfly/app_spec.rb
542
+ - spec/dragonfly/configurable_spec.rb
543
+ - spec/dragonfly/cookie_monster_spec.rb
544
+ - spec/dragonfly/core_ext/array_spec.rb
545
+ - spec/dragonfly/core_ext/hash_spec.rb
546
+ - spec/dragonfly/data_storage/couch_data_store_spec.rb
547
+ - spec/dragonfly/data_storage/file_data_store_spec.rb
548
+ - spec/dragonfly/data_storage/mongo_data_store_spec.rb
549
+ - spec/dragonfly/data_storage/s3_data_store_spec.rb
550
+ - spec/dragonfly/data_storage/shared_data_store_examples.rb
551
+ - spec/dragonfly/function_manager_spec.rb
552
+ - spec/dragonfly/has_filename_spec.rb
553
+ - spec/dragonfly/hash_with_css_style_keys_spec.rb
554
+ - spec/dragonfly/image_magick/analyser_spec.rb
555
+ - spec/dragonfly/image_magick/encoder_spec.rb
556
+ - spec/dragonfly/image_magick/generator_spec.rb
557
+ - spec/dragonfly/image_magick/processor_spec.rb
558
+ - spec/dragonfly/job_builder_spec.rb
559
+ - spec/dragonfly/job_definitions_spec.rb
560
+ - spec/dragonfly/job_endpoint_spec.rb
561
+ - spec/dragonfly/job_spec.rb
562
+ - spec/dragonfly/loggable_spec.rb
563
+ - spec/dragonfly/middleware_spec.rb
564
+ - spec/dragonfly/routed_endpoint_spec.rb
565
+ - spec/dragonfly/serializer_spec.rb
566
+ - spec/dragonfly/server_spec.rb
567
+ - spec/dragonfly/shell_spec.rb
568
+ - spec/dragonfly/simple_cache_spec.rb
569
+ - spec/dragonfly/temp_object_spec.rb
570
+ - spec/dragonfly/url_attributes.rb
571
+ - spec/dragonfly/url_mapper_spec.rb
572
+ - spec/functional/deprecations_spec.rb
573
+ - spec/functional/image_magick_app_spec.rb
574
+ - spec/functional/model_urls_spec.rb
575
+ - spec/functional/remote_on_the_fly_spec.rb
576
+ - spec/functional/shell_commands_spec.rb
577
+ - spec/functional/to_response_spec.rb
578
+ - spec/functional/urls_spec.rb
579
+ - spec/spec_helper.rb
580
+ - spec/support/argument_matchers.rb
581
+ - spec/support/image_matchers.rb
582
+ - spec/support/simple_matchers.rb
583
+ - spec/test_imagemagick.ru
584
+ has_rdoc:
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.9.14