Software /
code /
prosody
Diff
net/http/files.lua @ 13868:14b52f217f7a 13.0
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 25 Apr 2025 17:05:13 +0200 |
parent | 13446:dba7073f1452 |
line wrap: on
line diff
--- 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 };