diff options
author | 2021-12-16 01:48:31 -0800 | |
---|---|---|
committer | 2021-12-16 01:48:31 -0800 | |
commit | 52f4ba767acb3d063e53d073989f91a407a7df61 (patch) | |
tree | d957f8ac063a5b8a66d1cf0f53f6974ae7b6a1ff | |
parent | 0f853a2fee89aec4a8006412340e82d504bb01da (diff) | |
download | bun-52f4ba767acb3d063e53d073989f91a407a7df61.tar.gz bun-52f4ba767acb3d063e53d073989f91a407a7df61.tar.zst bun-52f4ba767acb3d063e53d073989f91a407a7df61.zip |
[http] Fix bug with `Link` header
-rw-r--r-- | src/http.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/http.zig b/src/http.zig index e34790377..4f978d44d 100644 --- a/src/http.zig +++ b/src/http.zig @@ -225,7 +225,11 @@ pub const RequestContext = struct { writer.writeAll(std.mem.trim(u8, this.bundler.options.routes.asset_prefix_path, "/")) catch break :module_preload; } - writer.writeAll(match.file_path[Fs.FileSystem.instance.top_level_dir.len..]) catch break :module_preload; + // include that trailing slash + // this should never overflow because the directory will be "/" if it's a root + if (comptime Environment.isDebug) std.debug.assert(Fs.FileSystem.instance.top_level_dir.len > 0); + + writer.writeAll(match.file_path[Fs.FileSystem.instance.top_level_dir.len - 1 ..]) catch break :module_preload; writer.writeAll(">; rel=modulepreload") catch break :module_preload; |