rails_imager 0.0.14 → 0.0.15

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: 7a6b11ddfb2b441dafd1bccf0b3f5c9c6cfb99de
4
- data.tar.gz: e038f4b3b581023c441c1d3d95762eb0579baee9
3
+ metadata.gz: faf8ac77f14d52b15633279599d4019ba361d6a8
4
+ data.tar.gz: 4610c1a6e2e33aa0d22b98ffcb15fc5f8260f0f2
5
5
  SHA512:
6
- metadata.gz: 3371b36d965880c3d93e40d6bde6ceca867f21464f4ade9727738b176499dffe985113e78ed078413c5748aa1ed2ca4d57b506b021cf223efab50ab1716818b8
7
- data.tar.gz: dbac1e92a0d1a124b94ce6cd8a6b8c8318894df486248e48332b031a944f8d6f229ce21d2de1e78a57fefc2c67351155aca4295952f52b7a73a7c797d145be05
6
+ metadata.gz: ea67285e3137d64be22d25de1a54bdf23bece4f78eaae447ccf7f8a01e8f385123889ec966dd0722137bbf4c4b98c963426cdc6b7ac9d3dd8373bad7128c29d7
7
+ data.tar.gz: d84e9da88ec02a30060f64cb993b12c491644e59bba52d6ee947a8f26734fbe3ed27b3b936a9292dc2a147ec2cb60c3cfe19f2566277622b9dc6ed4fdf4dd9b4
@@ -10,7 +10,9 @@ class RailsImager::ImagesController < ApplicationController
10
10
  raise ArgumentError, "Invalid parameter: '#{key}'." unless RailsImager::ImageHandler::PARAMS_ARGS.map{ |param| param.to_s }.include?(key)
11
11
  end
12
12
 
13
- image_path = "#{Rails.public_path}/#{params[:id]}"
13
+ image_id = params[:id].to_s.gsub("%C3%B8", "ø")
14
+
15
+ image_path = "#{Rails.public_path}/#{image_id}"
14
16
  image_path = File.realpath(image_path)
15
17
  validate_path(image_path)
16
18
 
@@ -9,12 +9,35 @@ module RailsImager::ImagesHelper
9
9
  path = path_without_public
10
10
  end
11
11
 
12
+ newpath = ""
13
+
14
+ if args[:url]
15
+ args.delete(:url)
16
+ newpath << "#{request.protocol}#{request.host_with_port}"
17
+ elsif args[:mailer]
18
+ args.delete(:mailer)
19
+
20
+ if ActionMailer::Base.default_url_options[:protocol]
21
+ newpath << ActionMailer::Base.default_url_options[:protocol]
22
+ else
23
+ newpath << "http://"
24
+ end
25
+
26
+ newpath << ActionMailer::Base.default_url_options[:host]
27
+
28
+ if ActionMailer::Base.default_url_options[:port]
29
+ newpath << ":#{ActionMailer::Base.default_url_options[:port]}"
30
+ end
31
+ end
32
+
12
33
  # Check for invalid parameters.
13
34
  args.each do |key, val|
14
35
  raise ArgumentError, "Invalid parameter: '#{key}'." unless RailsImager::ImageHandler::PARAMS_ARGS.include?(key)
15
36
  end
16
37
 
17
- newpath = "/rails_imager/images/"
38
+
39
+
40
+ newpath << "/rails_imager/images/"
18
41
  newpath << URI.encode(path)
19
42
  newpath << "/?"
20
43
 
@@ -1,3 +1,3 @@
1
1
  module RailsImager
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
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.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
@@ -109,7 +109,6 @@ files:
109
109
  - app/assets/stylesheets/rails_imager/images.css
110
110
  - app/controllers/rails_imager/images_controller.rb
111
111
  - app/controllers/rails_imager/application_controller.rb
112
- - app/views/rails_imager/images/show.html.erb
113
112
  - app/views/layouts/rails_imager/application.html.erb
114
113
  - config/routes.rb
115
114
  - lib/rails_imager/engine.rb
@@ -1,2 +0,0 @@
1
- <h1>Images#show</h1>
2
- <p>Find me in app/views/rails_imager/images/show.html.erb</p>