rack-canonical_link 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,8 @@ module Rack
12
12
  if env['rack.url_scheme'] != 'https' && (@headers['Content-Type'] =~ /application\/html/ || @headers['Content-Type'] =~ /text\/html/)
13
13
  request = Rack::Request.new env
14
14
  new_body = []
15
- @body.each {|fragement| new_body << fragement.gsub(%r{</head>}, '<link href="' + request.url + '" rel="canonical" /></head>') }
15
+
16
+ @body.each {|fragement| new_body << fragement.gsub(%r{</head>}, '<link href="' + request.url.gsub(/\/$/,'') + '" rel="canonical" /></head>') }
16
17
  @body = new_body
17
18
  end
18
19
 
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class CanonicalLink
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ module Rack
12
12
  end
13
13
 
14
14
  it 'should inject canonical tag of http HTML request' do
15
- get('/').body.should == '<html><head>Hello world<link href="http://example.org/" rel="canonical" /></head><body></body></html>'
15
+ get('/').body.should == '<html><head>Hello world<link href="http://example.org" rel="canonical" /></head><body></body></html>'
16
16
  end
17
17
 
18
18
  it 'should not inject canonical tag into non HTML requests for HTTP' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-canonical_link
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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-09-03 00:00:00.000000000 Z
12
+ date: 2013-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack