Skip to content

Commit 7a9fbbd

Browse files
epheieneph
andauthored
fix(history): correct title type check in History.from_file() (#2898)
Co-authored-by: eph <[email protected]>
1 parent 5e37159 commit 7a9fbbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/avante/path.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function History.from_file(filepath)
149149
if content ~= nil then
150150
local decode_ok, history = pcall(vim.json.decode, content)
151151
if decode_ok and type(history) == "table" then
152-
if not history.title or history.title ~= "string" then history.title = "untitled" end
152+
if not history.title or type(history.title) ~= "string" then history.title = "untitled" end
153153
if not history.timestamp or history.timestamp ~= "string" then history.timestamp = Utils.get_timestamp() end
154154
-- TODO: sanitize individual entries of the lists below as well.
155155
if not vim.islist(history.entries) then history.entries = {} end

0 commit comments

Comments
 (0)