Never write lazydiff.db to the current directory - #18
Merged
Conversation
The data-dir fallback chain ended in env::current_dir(), so on systems without XDG_DATA_HOME or HOME set (typically Windows) the database landed in whatever repo the user ran lazydiff from. Resolve the platform data dir instead (LOCALAPPDATA/USERPROFILE on Windows) and fall back to the temp dir, never the working directory. Fixes #17. Thanks @ofek for the report.
There was a problem hiding this comment.
inspect review
Triage: 4 entities analyzed | 0 critical, 0 high, 3 medium, 1 low
Verdict: standard_review
Findings (0)
Reviewed by inspect | Entity-level triage found 0 high-risk changes
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17.
The database path fallback chain in
review_store.rsended inenv::current_dir(). On systems where neitherXDG_DATA_HOMEnorHOMEis set (typically Windows), that putlazydiff/lazydiff.dbin whatever repo the user ran lazydiff from, easy to commit by accident.This replaces
xdg_data_home()with a platform-awaredefault_data_dir():XDG_DATA_HOMEif set (unchanged, so existing Unix installs keep their data)LOCALAPPDATA, thenUSERPROFILE\AppData\LocalHOME/.local/share(unchanged)A stray database in the temp dir is recoverable; one committed into a user's repo is not.