golf 0.1.5 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/golf/rack.rb +6 -2
  2. data/lib/golf/version.rb +1 -1
  3. metadata +1 -1
data/lib/golf/rack.rb CHANGED
@@ -11,10 +11,14 @@ module Golf
11
11
 
12
12
  def call(env)
13
13
  code = "200"
14
+
15
+ if ['Gemfile','config.ru', 'Gemfile.lock'].include?(env["PATH_INFO"])
16
+ return [404, { 'Content-Type' => 'text/plain', 'Content-Length' => '9'}, ['not found']]
17
+ end
14
18
 
15
- if File.exists?(env["PATH_INFO"]) and env["PATH_INFO"] != "/"
19
+ if File.exists?(env["PATH_INFO"].sub('/','')) and env["PATH_INFO"] != "/"
16
20
  mime = MIME_TYPES[".#{env["PATH_INFO"].split('.').last}"]
17
- result = File.read(env["PATH_INFO"])
21
+ result = File.read(env["PATH_INFO"].sub('/',''))
18
22
  return [code, { 'Content-Type' => mime, 'Content-Length' => result.length.to_s}, [result]]
19
23
  end
20
24
 
data/lib/golf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Golf
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: golf
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Micha Niskin, Alan Dipert, Julio Capote