Sinatra now correctly returns code 404 when a page is not found. Closes #1198
This commit is contained in:
parent
1bd2b62a80
commit
09558c64e6
3
Gemfile
3
Gemfile
@ -2,7 +2,6 @@ source "http://rubygems.org"
|
|||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem 'rake', '~> 0.9'
|
gem 'rake', '~> 0.9'
|
||||||
gem 'rack', '~> 1.4.1'
|
|
||||||
gem 'jekyll', '~> 0.12'
|
gem 'jekyll', '~> 0.12'
|
||||||
gem 'rdiscount', '~> 1.6.8'
|
gem 'rdiscount', '~> 1.6.8'
|
||||||
gem 'pygments.rb', '~> 0.3.4'
|
gem 'pygments.rb', '~> 0.3.4'
|
||||||
@ -16,4 +15,4 @@ group :development do
|
|||||||
gem 'liquid', '~> 2.3.0'
|
gem 'liquid', '~> 2.3.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'sinatra', '~> 1.3.5'
|
gem 'sinatra', '~> 1.4.2'
|
||||||
|
17
Gemfile.lock
17
Gemfile.lock
@ -28,8 +28,8 @@ GEM
|
|||||||
pygments.rb (0.3.4)
|
pygments.rb (0.3.4)
|
||||||
posix-spawn (~> 0.3.6)
|
posix-spawn (~> 0.3.6)
|
||||||
yajl-ruby (~> 1.1.0)
|
yajl-ruby (~> 1.1.0)
|
||||||
rack (1.4.5)
|
rack (1.5.2)
|
||||||
rack-protection (1.3.2)
|
rack-protection (1.5.0)
|
||||||
rack
|
rack
|
||||||
rake (0.9.2.2)
|
rake (0.9.2.2)
|
||||||
rb-fsevent (0.9.1)
|
rb-fsevent (0.9.1)
|
||||||
@ -38,13 +38,13 @@ GEM
|
|||||||
sass (3.1.20)
|
sass (3.1.20)
|
||||||
sass-globbing (1.0.0)
|
sass-globbing (1.0.0)
|
||||||
sass (>= 3.1)
|
sass (>= 3.1)
|
||||||
sinatra (1.3.5)
|
sinatra (1.4.2)
|
||||||
rack (~> 1.4)
|
rack (~> 1.5, >= 1.5.2)
|
||||||
rack-protection (~> 1.3)
|
rack-protection (~> 1.4)
|
||||||
tilt (~> 1.3, >= 1.3.3)
|
tilt (~> 1.3, >= 1.3.4)
|
||||||
stringex (1.4.0)
|
stringex (1.4.0)
|
||||||
syntax (1.0.0)
|
syntax (1.0.0)
|
||||||
tilt (1.3.3)
|
tilt (1.3.7)
|
||||||
yajl-ruby (1.1.0)
|
yajl-ruby (1.1.0)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
@ -57,11 +57,10 @@ DEPENDENCIES
|
|||||||
jekyll (~> 0.12)
|
jekyll (~> 0.12)
|
||||||
liquid (~> 2.3.0)
|
liquid (~> 2.3.0)
|
||||||
pygments.rb (~> 0.3.4)
|
pygments.rb (~> 0.3.4)
|
||||||
rack (~> 1.4.1)
|
|
||||||
rake (~> 0.9)
|
rake (~> 0.9)
|
||||||
rb-fsevent (~> 0.9)
|
rb-fsevent (~> 0.9)
|
||||||
rdiscount (~> 1.6.8)
|
rdiscount (~> 1.6.8)
|
||||||
rubypants (~> 0.2.0)
|
rubypants (~> 0.2.0)
|
||||||
sass-globbing (~> 1.0.0)
|
sass-globbing (~> 1.0.0)
|
||||||
sinatra (~> 1.3.5)
|
sinatra (~> 1.4.2)
|
||||||
stringex (~> 1.4.0)
|
stringex (~> 1.4.0)
|
||||||
|
@ -11,7 +11,7 @@ class SinatraStaticServer < Sinatra::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
not_found do
|
not_found do
|
||||||
send_sinatra_file('404.html') {"Sorry, I cannot find #{request.path}"}
|
send_file(File.join(File.dirname(__FILE__), 'public', '404.html'), {:status => 404})
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_sinatra_file(path, &missing_file_block)
|
def send_sinatra_file(path, &missing_file_block)
|
||||||
|
Loading…
Reference in New Issue
Block a user