From 593199caa49d33c8d2cd9d2c1a99cb538d2ba361 Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 5 Dec 2025 00:29:11 -0500 Subject: [PATCH] Update httplib.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- httplib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httplib.h b/httplib.h index fd233b4..d11c002 100644 --- a/httplib.h +++ b/httplib.h @@ -2976,7 +2976,8 @@ inline std::string from_i_to_hex(size_t n) { inline std::string compute_etag(const FileStat &fs) { if (!fs.is_file()) { return std::string(); } - auto mtime = static_cast(fs.mtime()); + time_t mtime_raw = fs.mtime(); + size_t mtime = mtime_raw < 0 ? 0 : static_cast(mtime_raw); auto size = fs.size(); return std::string("W/\"") + from_i_to_hex(mtime) + "-" +