Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serveStatic does not work when set absolute path to root #3107

Open
oon00b opened this issue Jul 7, 2024 · 1 comment · May be fixed by #3108
Open

serveStatic does not work when set absolute path to root #3107

oon00b opened this issue Jul 7, 2024 · 1 comment · May be fixed by #3108
Labels
enhancement New feature or request.

Comments

@oon00b
Copy link
Contributor

oon00b commented Jul 7, 2024

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

@oon00b oon00b added the triage label Jul 7, 2024
@yusukebe yusukebe added enhancement New feature or request. and removed triage labels Jul 7, 2024
@ckken
Copy link

ckken commented Jul 11, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants