Skip to content

Commit

Permalink
fix: handle symlinks in chat checks (issue: #104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robitx committed Feb 28, 2024
1 parent 8d2f1af commit d76be3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/gp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,10 @@ end
---@param file_name string # file name
---@return string | nil # reason for not being a chat or nil if it is a chat
M.not_chat = function(buf, file_name)
if not _H.starts_with(file_name, M.config.chat_dir) then
return "not in chat directory (" .. M.config.chat_dir .. ")"
file_name = vim.fn.resolve(file_name)
local chat_dir = vim.fn.resolve(M.config.chat_dir)
if not _H.starts_with(file_name, chat_dir) then
return "resolved file (" .. file_name .. ") not in chat dir (" .. chat_dir .. ")"
end

local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
Expand Down

0 comments on commit d76be3d

Please sign in to comment.