rack-asset-compiler 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,9 +57,11 @@ module Rack
57
57
  if(request_parts.take(match_parts.length) == match_parts)
58
58
  request_base = request_parts[match_parts.length..-1]
59
59
 
60
+ # Directory listsings not supported
61
+ return response( 403, 'Forbidden') if F.directory? F.join(source_dir, request_base)
62
+
60
63
  # Swap in the source file extension
61
64
  request_base[-1].sub!(/\.\w+$/, '.' + source_extension)
62
-
63
65
  source_file = F.join(source_dir, request_base)
64
66
 
65
67
  if F.exists?(source_file)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rack-asset-compiler'
3
- s.version = "0.2.0"
3
+ s.version = "0.2.1"
4
4
  s.author = 'Jonathan Baudanza'
5
5
  s.email = 'jon@jonb.org'
6
6
  s.summary = 'Rack Middleware to facilitate the generic compiling static assets.'
@@ -50,6 +50,11 @@ describe "AssetCompiler" do
50
50
  last_response.body.should == 'chickenscript'
51
51
  end
52
52
 
53
+ it "should return a 403 error when a directory is requested" do
54
+ get '/chickenscripts/'
55
+ last_response.status.should == 403
56
+ end
57
+
53
58
  it "should not call the compiler for missing files" do
54
59
  get '/chickenscripts/missing.chickenscript'
55
60
  @source_file.should be_nil
@@ -120,4 +125,4 @@ describe "AssetCompiler" do
120
125
  last_response.headers.should include('Expires')
121
126
  end
122
127
  end
123
- end
128
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-asset-compiler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Baudanza
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-17 00:00:00 -07:00
18
+ date: 2011-04-19 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency