Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes bug deleting chat file when config.chat_dir contains a symlink #171

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

Odie
Copy link
Contributor

@Odie Odie commented Jul 25, 2024

The Bug

When deleting a chat, if any path component in config.chat_dir is a symlink, the following sanity check fails:

	if not _H.starts_with(file_name, M.config.chat_dir) then
		M.logger.warning("File " .. vim.inspect(file_name) .. " is not in chat dir")
		return
	end

This causes the GpChatDelete command to always fail in such cases.

The fix

Resolve chat_dir symlinks when performing the sanity check.

@Odie
Copy link
Contributor Author

Odie commented Jul 25, 2024

It might be a good idea to have a helper function to always retrieve the resolved version of config.chat_dir. Alternatively, it's also possible to just resolve the config.chat_dir during setup. Either case, it should make these kinds of bugs very unlikely to show up. =)

@Robitx Robitx merged commit 129c2f8 into Robitx:main Jul 26, 2024
1 check failed
Robitx pushed a commit that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants