Diff

net/http/files.lua @ 13872:76582d10bc09 default tip

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 05 May 2025 17:30:06 +0200
parent 13868:14b52f217f7a
line wrap: on
line diff
--- a/net/http/files.lua	Mon May 05 17:14:57 2025 +0200
+++ b/net/http/files.lua	Mon May 05 17:30:06 2025 +0200
@@ -90,11 +90,12 @@
 			return 304;
 		end
 
-		local data = cache:get(orig_path);
-		if data and data.etag == etag then
-			response_headers.content_type = data.content_type;
-			data = data.data;
-			cache:set(orig_path, data);
+		local data;
+		local cached = cache:get(orig_path);
+		if cached and cached.etag == etag then
+			response_headers.content_type = cached.content_type;
+			data = cached.data;
+			cache:set(orig_path, cached);
 		elseif attr.mode == "directory" and path then
 			if full_path:sub(-1) ~= "/" then
 				local dir_path = { is_absolute = true, is_directory = true };