rails_imager 0.0.28 → 0.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ea1a92bb217a6904011807d394beb5e65ac2b7b
4
- data.tar.gz: b8e4d70468ad7542d47234661e536a7189e826e4
3
+ metadata.gz: ad885a728aa0846c006101b996e62bbd99819421
4
+ data.tar.gz: afca7bba536f7d5a2463cbc48c5456fe9566f03b
5
5
  SHA512:
6
- metadata.gz: fd6e31df3ff0625238204c5174d30fae4334ea7c0a8dd4b120da34ceb1544539a57525461729f77fa576d1d19b2e96d6670b0bacbd066b4986af917c325ce5c2
7
- data.tar.gz: 52f3abddb654d531b817d30b4abdcc80224b710e6b7df23c22e4c926a595273570c189632c36258870a1cfa6350d93f495f1bffc1812a13fdbb82119b8e2766b
6
+ metadata.gz: 304e153bf47f4e333ca0c6a94c59fa3b049c25c12e903d95e6ff1176606f056ccbddbb4d7d7ff2846c4bd1b8b3259b3d78ffd00342348f1683b294ac02e1253f
7
+ data.tar.gz: dae814c368d23c0565491dee9b46a2cb5282f11451c3608ca41098fef027379989b2fc8f1b425839977f7d0156b40fad39bdc4a20f7815ad502af3497228932e
data/README.md CHANGED
@@ -31,6 +31,11 @@ module ApplicationHelper
31
31
  end
32
32
  ```
33
33
 
34
+ In case you use RailsImager in an engine, you might want to alter the path through an initializer file (config/initializers/rails_imager.rb):
35
+ ```ruby
36
+ RailsImager.config.path = "/my_engine/rails_imager"
37
+ ```
38
+
34
39
  ## Capistrano
35
40
 
36
41
  If you use Capistrano to deploy, you probably symlink the "public/system" directory, in order to share uploaded images between releases. This screws with RailsImager's security only to serve images from the "public"-folder.
@@ -73,10 +73,15 @@ private
73
73
 
74
74
  def path_from_arg(path)
75
75
  if path.class.name == "Paperclip::Attachment"
76
- raise "Paperclip path does not start with public path: #{path.path}" unless path.path.to_s.start_with?(Rails.public_path.to_s)
77
- path_without_public = path.path.to_s.gsub("#{Rails.public_path}/", "")
78
- raise "Path didn't change '#{path.path}' - '#{path_without_public}'." if path.path.to_s == path_without_public
79
- return path_without_public
76
+ # Ignore check when running tests - its normal to store Paperclip::Attachment's elsewhere for easy cleanup
77
+ if Rails.env.test?
78
+ return path.path.to_s
79
+ else
80
+ raise "Paperclip path does not start with public path: #{path.path}" unless path.path.to_s.start_with?(Rails.public_path.to_s)
81
+ path_without_public = path.path.to_s.gsub("#{Rails.public_path}/", "")
82
+ raise "Path didn't change '#{path.path}' - '#{path_without_public}'." if path.path.to_s == path_without_public
83
+ return path_without_public
84
+ end
80
85
  elsif path.is_a?(String)
81
86
  return path
82
87
  else
@@ -1,3 +1,3 @@
1
1
  module RailsImager
2
- VERSION = "0.0.28"
2
+ VERSION = "0.0.29"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_imager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj