We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef7de96 commit 61d142dCopy full SHA for 61d142d
src/serve-static.ts
@@ -92,11 +92,24 @@ export const serveStatic = <E extends Env = any>(
92
root,
93
!optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename
94
)
95
+
96
+ try {
97
+ path = realpathSync(path)
98
+ } catch {
99
+ await options.onNotFound?.(path, c)
100
+ return next()
101
+ }
102
103
let stats = getStats(path)
104
105
if (stats && stats.isDirectory()) {
106
const indexFile = options.index ?? 'index.html'
- path = realpathSync(join(path, indexFile))
107
108
+ path = realpathSync(join(path, indexFile))
109
110
111
112
113
stats = getStats(path)
114
}
115
0 commit comments