Skip to content

Fix encrypt/decrypt crash when .gitignore is missing - #33

Closed
agrublev with Copilot wants to merge 3 commits into
Developmentfrom
copilot/encrypt-decrypt-issue
Closed

Fix encrypt/decrypt crash when .gitignore is missing#33
agrublev with Copilot wants to merge 3 commits into
Developmentfrom
copilot/encrypt-decrypt-issue

Conversation

Copilot AI commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

fsr encryption (and the encrypt/decrypt flows it drives) crashed whenever the project had no .gitignore file: utils.readFile returned {} on read error, so encryption.js died at encrypted.ignore.split("\n") with TypeError: encrypted.ignore.split is not a function — nothing got encrypted or decrypted.

Changes

  • lib/utils/helpers.jsreadFile now returns "" (a safe string default) on error instead of {}, and uses the async fs.readFile instead of readFileSync:
utils.readFile = async f => {
    try {
        return await fs.readFile(f, "utf8");
    } catch (err) {
        fsrLog.error(err);
        return ""; // was: {} — broke string callers like encryption.js
    }
};
  • tests/utils/helpers.test.js — updated the missing-file expectation from {} to "".
  • tests/encryption/encryption.test.js — regression test: init() encrypts listed files when .gitignore is missing.

Copilot AI and others added 3 commits August 12, 2026 05:59
…orks without .gitignore

Co-authored-by: agrublev <801433+agrublev@users.noreply.github.com>
… crash

Co-authored-by: agrublev <801433+agrublev@users.noreply.github.com>
…dFile "" fallback suffices)

Co-authored-by: agrublev <801433+agrublev@users.noreply.github.com>
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