From 7a9fbbd4ddc9affc6a33bff644b1af7c0f908e74 Mon Sep 17 00:00:00 2001 From: Epheien Date: Wed, 31 Dec 2025 01:03:37 +0800 Subject: [PATCH] fix(history): correct title type check in History.from_file() (#2898) Co-authored-by: eph --- lua/avante/path.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/avante/path.lua b/lua/avante/path.lua index ac2fcea..0ae164a 100644 --- a/lua/avante/path.lua +++ b/lua/avante/path.lua @@ -149,7 +149,7 @@ function History.from_file(filepath) if content ~= nil then local decode_ok, history = pcall(vim.json.decode, content) if decode_ok and type(history) == "table" then - if not history.title or history.title ~= "string" then history.title = "untitled" end + if not history.title or type(history.title) ~= "string" then history.title = "untitled" end if not history.timestamp or history.timestamp ~= "string" then history.timestamp = Utils.get_timestamp() end -- TODO: sanitize individual entries of the lists below as well. if not vim.islist(history.entries) then history.entries = {} end