@hono/node-server 1.13.2 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,7 +65,13 @@ var serveStatic = (options = { root: "" }) => {
65
65
  if (c.finalized) {
66
66
  return next();
67
67
  }
68
- const filename = options.path ?? decodeURIComponent(c.req.path);
68
+ let filename;
69
+ try {
70
+ filename = options.path ?? decodeURIComponent(c.req.path);
71
+ } catch {
72
+ await options.onNotFound?.(c.req.path, c);
73
+ return next();
74
+ }
69
75
  let path = (0, import_filepath.getFilePathWithoutDefaultDocument)({
70
76
  filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
71
77
  root: options.root
@@ -41,7 +41,13 @@ var serveStatic = (options = { root: "" }) => {
41
41
  if (c.finalized) {
42
42
  return next();
43
43
  }
44
- const filename = options.path ?? decodeURIComponent(c.req.path);
44
+ let filename;
45
+ try {
46
+ filename = options.path ?? decodeURIComponent(c.req.path);
47
+ } catch {
48
+ await options.onNotFound?.(c.req.path, c);
49
+ return next();
50
+ }
45
51
  let path = getFilePathWithoutDefaultDocument({
46
52
  filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
47
53
  root: options.root
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "1.13.2",
3
+ "version": "1.13.3",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",