Updated: added comment to discourage people from making the same mistake, removed swap file

This commit is contained in:
Michal Skorczak 2024-11-13 20:58:29 +00:00
parent c9b984d5df
commit 72e0ad13a2
2 changed files with 1 additions and 0 deletions

View file

@ -61,6 +61,7 @@ pub fn blog(self: *Self, req: zap.Request) void {
// looking for /blog?post=post_name // looking for /blog?post=post_name
if(req.getParamSlice("post")) |value| { if(req.getParamSlice("post")) |value| {
std.log.info("post name: {s}", .{value}); std.log.info("post name: {s}", .{value});
// THIS IS SO DANGEROUS WHY DID I LET THIS THROUGH AHAHAHAHA
const filepath = std.fmt.allocPrint(self.allocator, "src/public/blog/{s}", .{value}) catch return; const filepath = std.fmt.allocPrint(self.allocator, "src/public/blog/{s}", .{value}) catch return;
defer self.allocator.free(filepath); defer self.allocator.free(filepath);
const file_content = std.fs.cwd().readFileAlloc(self.allocator, filepath, std.math.maxInt(usize)) catch return; const file_content = std.fs.cwd().readFileAlloc(self.allocator, filepath, std.math.maxInt(usize)) catch return;

Binary file not shown.