Relative paths are not served well
Closed this issue · 9 comments
MWE of an HTML/CSS website layout:
$ tree .
.
├── html
└── my
└── page
├── index.css
└── index.html
3 directories, 3 files
my/page/index.css
body {
direction:rtl;
}
my/page/index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<link rel="stylesheet" type="text/css" href="index.css"/>
<title>-</title>
</head>
<body>
Hello world
</body>
</html>
Logs:
[2024-08-04T15:31:42Z WARN live_server::server] Failed to read "/home/doron/repos/live-server-relative-paths-issue-example/index.html": No such file or directory (os error 2)
[2024-08-04T15:31:42Z WARN live_server::server] Failed to read "/home/doron/repos/live-server-relative-paths-issue-example/favicon.ico": No such file or directory (os error 2)
[2024-08-04T15:31:47Z WARN live_server::server] Failed to read "/home/doron/repos/live-server-relative-paths-issue-example/my/index.css": No such file or directory (os error 2)
Whereas if I open the same index.html
file directly in the browser, the css file is loaded correctly - as can be seen by the body
direction.
When working on my website, which has multiple index.css
files, this bug was very confusing to me.
What is your live-server
command line (in relation to those files) and the HTTP requests you're making?
What is your
live-server
command line (in relation to those files)
Only --open
is used as a command line argument, and it is launched in /home/doron/repos/live-server-relative-paths-issue-example
.
and the HTTP requests you're making?
I'm using the browser (Firefox).
and the HTTP requests you're making?
I mean, is it e.g. http://127.0.0.1:56122/my/page/index.html then?
I cannot reproduce it here:
D:\test> live-server 2024/08/06 23:35:11
[2024-08-06T15:35:16Z INFO live_server::server] Listening on http://192.168.31.113:8860/
[2024-08-06T15:35:16Z INFO live_server::watcher] Listening on \\?\D:\test
[2024-08-06T15:35:21Z WARN live_server::server] Failed to read "\\?\D:\test\favicon.ico": 系统找不到指定的文件。 (os error 2)
I cannot reproduce it here:
Very peculiar! I just tested it again also with chromium and same issue. However, testing the latest version from Git seemed to fix the issue! The stable release that has this issue that I'm using here on NixOS is 0.7.0. Is there a chance for a new release please? 🙏
Closed as v0.8.0 has just released
Thanks!