Browse Source

Sinatra now correctly returns code 404 when a page is not found. Closes #1198

Brandon Mathis 6 years ago
parent
commit
09558c64e6
3 changed files with 10 additions and 12 deletions
  1. 1
    2
      Gemfile
  2. 8
    9
      Gemfile.lock
  3. 1
    1
      config.ru

+ 1
- 2
Gemfile View File

@@ -2,7 +2,6 @@ source "http://rubygems.org"
2 2
 
3 3
 group :development do
4 4
   gem 'rake', '~> 0.9'
5
-  gem 'rack', '~> 1.4.1'
6 5
   gem 'jekyll', '~> 0.12'
7 6
   gem 'rdiscount', '~> 1.6.8'
8 7
   gem 'pygments.rb', '~> 0.3.4'
@@ -16,4 +15,4 @@ group :development do
16 15
   gem 'liquid', '~> 2.3.0'
17 16
 end
18 17
 
19
-gem 'sinatra', '~> 1.3.5'
18
+gem 'sinatra', '~> 1.4.2'

+ 8
- 9
Gemfile.lock View File

@@ -28,8 +28,8 @@ GEM
28 28
     pygments.rb (0.3.4)
29 29
       posix-spawn (~> 0.3.6)
30 30
       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)
33 33
       rack
34 34
     rake (0.9.2.2)
35 35
     rb-fsevent (0.9.1)
@@ -38,13 +38,13 @@ GEM
38 38
     sass (3.1.20)
39 39
     sass-globbing (1.0.0)
40 40
       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)
45 45
     stringex (1.4.0)
46 46
     syntax (1.0.0)
47
-    tilt (1.3.3)
47
+    tilt (1.3.7)
48 48
     yajl-ruby (1.1.0)
49 49
 
50 50
 PLATFORMS
@@ -57,11 +57,10 @@ DEPENDENCIES
57 57
   jekyll (~> 0.12)
58 58
   liquid (~> 2.3.0)
59 59
   pygments.rb (~> 0.3.4)
60
-  rack (~> 1.4.1)
61 60
   rake (~> 0.9)
62 61
   rb-fsevent (~> 0.9)
63 62
   rdiscount (~> 1.6.8)
64 63
   rubypants (~> 0.2.0)
65 64
   sass-globbing (~> 1.0.0)
66
-  sinatra (~> 1.3.5)
65
+  sinatra (~> 1.4.2)
67 66
   stringex (~> 1.4.0)

+ 1
- 1
config.ru View File

@@ -11,7 +11,7 @@ class SinatraStaticServer < Sinatra::Base
11 11
   end
12 12
 
13 13
   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})
15 15
   end
16 16
 
17 17
   def send_sinatra_file(path, &missing_file_block)

Loading…
Cancel
Save