# HG changeset patch # User Kim Alvefur # Date 1745593513 -7200 # Node ID 14b52f217f7a4ebfceb92407aee98d14d91ea409 # Parent eabd38507c1d713f4d5442655e8bf482a428cca1 net.http.files: Fix #1927 Problem was type confusion where the `data` variable was expected to be a string later but ended up being the table stored in the cache. Here a different variable is used for the cache entry and the data. diff -r eabd38507c1d -r 14b52f217f7a net/http/files.lua --- a/net/http/files.lua Sun Mar 30 17:27:23 2025 +0200 +++ b/net/http/files.lua Fri Apr 25 17:05:13 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 };