`serveStatic` does not work when set absolute path to `root`
oon00b opened this issue · comments
What version of Hono are you using?
4.4.12
What runtime/platform is your app running on?
Deno and Bun
What steps can reproduce the bug?
This is minimal script to reproduce the bug. This script can be executed with deno run --allow-net --allow-read
command.
import { Hono } from "jsr:@hono/hono@^4.4.12";
import { serveStatic } from "jsr:@hono/hono@^4.4.12/deno";
const app = new Hono();
app.use(
"*",
serveStatic({
root: "/tmp/public_html"
})
);
Deno.serve(app.fetch);
The directory structure of /tmp/public_html/
:
/tmp/public_html/
└── index.html
/tmp/public_html/index.html
:
<p>test</p>
When accsessing http://localhost:8000
, the server returns 404 Not Found
and outputs an error:
NotFound: No such file or directory (os error 2): open './tmp/public_html/index.html'
NotFound: No such file or directory (os error 2): open './tmp/public_html/'
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
+1