Skip to content

Commit

Permalink
Don't serve static content unless configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
hns committed May 17, 2011
1 parent 5a5b626 commit c25400a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/stick/middleware/static.js
Expand Up @@ -36,14 +36,16 @@ exports.middleware = function static(next, app) {
};

return function static(request) {
var path = request.pathInfo;
if (indexDocument && path.charAt(path.length-1) === "/") {
path += indexDocument;
}
if (path.length > 1) {
var resource = baseRepository.getResource(path);
if (resource && resource.exists()) {
return response.static(resource, mimeType(path, "text/plain"));
if (baseRepository) {
var path = request.pathInfo;
if (indexDocument && path.charAt(path.length-1) === "/") {
path += indexDocument;
}
if (path.length > 1) {
var resource = baseRepository.getResource(path);
if (resource && resource.exists()) {
return response.static(resource, mimeType(path, "text/plain"));
}
}
}
return next(request);
Expand Down

0 comments on commit c25400a

Please sign in to comment.