rack-rewrite-dynamic 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ require 'uri'
1
2
  module Rack
2
3
  class Rewrite
3
4
  module Dynamic
@@ -38,11 +39,16 @@ module Rack
38
39
  if slug
39
40
  route_generator_klass.route_for slug
40
41
  else
41
- rack_env['REQUEST_URI'] || rack_env['PATH_INFO']
42
+ original_path(rack_env)
42
43
  end
43
44
  end
44
45
  def original_path(rack_env)
45
- rack_env['REQUEST_URI'] || rack_env['PATH_INFO']
46
+ if rack_env['REQUEST_URI']
47
+ uri = URI.parse(rack_env['REQUEST_URI'])
48
+ "#{uri.path}#{'?'+uri.query if uri.query}"
49
+ else
50
+ rack_env['PATH_INFO']
51
+ end
46
52
  end
47
53
  end
48
54
  end
@@ -27,9 +27,9 @@ module Rack
27
27
  slugs.each do |s|
28
28
  add_filter_param(filter_params, s)
29
29
  end
30
+ return "/#{@opts[:target]}?#{filter_params.to_query}" if filter_params.length > 0
30
31
  end
31
-
32
- return "/#{@opts[:target]}?#{filter_params.to_query}" if filter_params.length > 0
32
+ original_path(rack_env)
33
33
  end
34
34
  original_path(rack_env)
35
35
  end
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  class Rewrite
3
3
  module Dynamic
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-rewrite-dynamic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-rewrite
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 1.8.24
122
+ rubygems_version: 1.8.23
123
123
  signing_key:
124
124
  specification_version: 3
125
125
  summary: SEO urls based on slugs