[http] Fix bug with Link header

This commit is contained in:
Jarred Sumner
2021-12-16 01:48:31 -08:00
parent 0f853a2fee
commit 52f4ba767a

View File

@@ -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;