Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 09558c6

Browse files
committed
Sinatra now correctly returns code 404 when a page is not found. Closes #1198
1 parent 1bd2b62 commit 09558c6

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

Gemfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source "http://rubygems.org"
22

33
group :development do
44
gem 'rake', '~> 0.9'
5-
gem 'rack', '~> 1.4.1'
65
gem 'jekyll', '~> 0.12'
76
gem 'rdiscount', '~> 1.6.8'
87
gem 'pygments.rb', '~> 0.3.4'
@@ -16,4 +15,4 @@ group :development do
1615
gem 'liquid', '~> 2.3.0'
1716
end
1817

19-
gem 'sinatra', '~> 1.3.5'
18+
gem 'sinatra', '~> 1.4.2'

Gemfile.lock

+8-9
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ GEM
2828
pygments.rb (0.3.4)
2929
posix-spawn (~> 0.3.6)
3030
yajl-ruby (~> 1.1.0)
31-
rack (1.4.5)
32-
rack-protection (1.3.2)
31+
rack (1.5.2)
32+
rack-protection (1.5.0)
3333
rack
3434
rake (0.9.2.2)
3535
rb-fsevent (0.9.1)
@@ -38,13 +38,13 @@ GEM
3838
sass (3.1.20)
3939
sass-globbing (1.0.0)
4040
sass (>= 3.1)
41-
sinatra (1.3.5)
42-
rack (~> 1.4)
43-
rack-protection (~> 1.3)
44-
tilt (~> 1.3, >= 1.3.3)
41+
sinatra (1.4.2)
42+
rack (~> 1.5, >= 1.5.2)
43+
rack-protection (~> 1.4)
44+
tilt (~> 1.3, >= 1.3.4)
4545
stringex (1.4.0)
4646
syntax (1.0.0)
47-
tilt (1.3.3)
47+
tilt (1.3.7)
4848
yajl-ruby (1.1.0)
4949

5050
PLATFORMS
@@ -57,11 +57,10 @@ DEPENDENCIES
5757
jekyll (~> 0.12)
5858
liquid (~> 2.3.0)
5959
pygments.rb (~> 0.3.4)
60-
rack (~> 1.4.1)
6160
rake (~> 0.9)
6261
rb-fsevent (~> 0.9)
6362
rdiscount (~> 1.6.8)
6463
rubypants (~> 0.2.0)
6564
sass-globbing (~> 1.0.0)
66-
sinatra (~> 1.3.5)
65+
sinatra (~> 1.4.2)
6766
stringex (~> 1.4.0)

config.ru

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SinatraStaticServer < Sinatra::Base
1111
end
1212

1313
not_found do
14-
send_sinatra_file('404.html') {"Sorry, I cannot find #{request.path}"}
14+
send_file(File.join(File.dirname(__FILE__), 'public', '404.html'), {:status => 404})
1515
end
1616

1717
def send_sinatra_file(path, &missing_file_block)

0 commit comments

Comments
 (0)