Fix nested paths in public folder on windows

This commit is contained in:
Dustin 2024-06-11 16:27:24 -06:00
parent 6ee43f7c9f
commit 33e76d74ad

View File

@ -608,10 +608,10 @@ fn matchPublicContent(self: *Server, request: *jetzig.http.Request) !?StaticReso
if (std.mem.eql(u8, file_path, request.path.file_path[1..])) { if (std.mem.eql(u8, file_path, request.path.file_path[1..])) {
const content = try iterable_dir.readFileAlloc( const content = try iterable_dir.readFileAlloc(
request.allocator, request.allocator,
file.path, file_path,
jetzig.config.get(usize, "max_bytes_public_content"), jetzig.config.get(usize, "max_bytes_public_content"),
); );
const extension = std.fs.path.extension(file.path); const extension = std.fs.path.extension(file_path);
const mime_type = if (self.mime_map.get(extension)) |mime| mime else "application/octet-stream"; const mime_type = if (self.mime_map.get(extension)) |mime| mime else "application/octet-stream";
return .{ return .{
.content = content, .content = content,