Skip to content

Commit

Permalink
fix(serveStatic): return next() if path is undef (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusukebe authored Jul 27, 2023
1 parent 992dc2b commit 8e50017
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@types/node": "^18.7.16",
"@types/supertest": "^2.0.12",
"esbuild": "^0.18.13",
"hono": "^3.3.0",
"hono": "^3.3.4",
"jest": "^29.6.1",
"np": "^7.7.0",
"publint": "^0.1.16",
Expand Down
2 changes: 2 additions & 0 deletions src/serve-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const serveStatic = (options: ServeStaticOptions = { root: '' }): Middlew
defaultDocument: options.index ?? 'index.html',
})

if (!path) return next()

path = `./${path}`

if (!existsSync(path)) {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2249,10 +2249,10 @@ hexoid@1.0.0:
resolved "https://registry.yarnpkg.com/hexoid/-/hexoid-1.0.0.tgz#ad10c6573fb907de23d9ec63a711267d9dc9bc18"
integrity sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==

hono@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/hono/-/hono-3.3.0.tgz#64ea5f85fd4e3e833036dd1a594627e65e7c0ab5"
integrity sha512-H15s0aRWebhry9d1yevYO2LqBbrJZTPZwui9S39mv6rZE9LdJWoYn2tWCa6etL3mlu5JHm0e3xVMcQiu2TfjJg==
hono@^3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/hono/-/hono-3.3.4.tgz#063655dd73e0f46a64682d65181f255551f4e6f1"
integrity sha512-lqvcsQrXS0bSydj/MkOXi3opAwrlauIjZefhXMMRj9prABfBWdrYHSrWk/xfxgxNPs4yuEMh2Z5zV0L2b1Jmdw==

hosted-git-info@^2.1.4:
version "2.8.9"
Expand Down

0 comments on commit 8e50017

Please sign in to comment.