Skip to content

Commit 8135831

Browse files
committed
- Update/fix: Protect additional fs.stat call (for defaultExtension)
- Refactoring: Reorder packge.json - npm: Bump to 0.1.1
1 parent 94045ce commit 8135831

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGES for `@brettz9/node-static`
22

3+
## 0.1.1
4+
5+
- Update/fix: Protect additional `fs.stat` call (for `defaultExtension`)
6+
37
## 0.1.0
48

59
Fork from `node-static`

lib/node-static.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Server.prototype.servePath = function (pathname, status, headers, req, res, fini
161161
if (e) {
162162
// possibly not found, check default extension
163163
if (that.defaultExtension) {
164-
fs.stat(pathname+that.defaultExtension, function(e2, stat2) {
164+
tryStat(pathname + that.defaultExtension, function(e2, stat2) {
165165
if (e2) {
166166
// really not found
167167
finish(404, {});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
{
22
"name": "@brettz9/node-static",
3+
"version": "0.1.1",
34
"description": "simple, compliant file streaming module for node",
4-
"keywords": [
5-
"http",
6-
"static",
7-
"file",
8-
"server"
9-
],
105
"author": "Brett Zamir",
116
"contributors": [
127
"Alexis Sellier <alexis@cloudhead.io>",
138
"Pablo Cantero <pablo@pablocantero.com>",
149
"Ionică Bizău <bizauionica@gmail.com>"
1510
],
11+
"main": "./lib/node-static",
12+
"license": "MIT",
13+
"bin": {
14+
"static": "bin/cli.js"
15+
},
16+
"keywords": [
17+
"http",
18+
"static",
19+
"file",
20+
"server"
21+
],
1622
"repository": {
1723
"type": "git",
1824
"url": "http://github.com/brettz9/node-static"
1925
},
20-
"main": "./lib/node-static",
2126
"scripts": {
2227
"start": "./bin/cli.js",
2328
"lint": "eslint .",
2429
"test": "vows --spec --isolate"
2530
},
26-
"bin": {
27-
"static": "bin/cli.js"
28-
},
29-
"license": "MIT",
3031
"dependencies": {
3132
"colors": "^1.4.0",
3233
"mime": "^2.5.2",
@@ -38,7 +39,6 @@
3839
"request": "latest",
3940
"vows": "latest"
4041
},
41-
"version": "0.1.0",
4242
"engines": {
4343
"node": ">=10.0.0"
4444
},

0 commit comments

Comments
 (0)