Skip to content

refactor(cli): extract sanitizeFilename to shared lib/file-utils#187

Merged
pchuri merged 1 commit into
mainfrom
refactor/extract-sanitize-filename
May 17, 2026
Merged

refactor(cli): extract sanitizeFilename to shared lib/file-utils#187
pchuri merged 1 commit into
mainfrom
refactor/extract-sanitize-filename

Conversation

@pchuri
Copy link
Copy Markdown
Owner

@pchuri pchuri commented May 17, 2026

Summary

  • sanitizeFilename was duplicated in bin/commands/attachments.js and bin/commands/export.js. Bug fixes to one wouldn't propagate to the other.
  • Extract the function to a new lib/file-utils.js and import it from both call sites.
  • Drop the sanitizeFilename re-export from export.js; update tests/export.test.js to import from the new module.

Test plan

  • npm test — 682 tests pass
  • npm run lint — clean

The same sanitizeFilename implementation lived in both bin/commands/attachments.js
and bin/commands/export.js, so any future fix had to be made twice. Move it to
lib/file-utils.js and import from both call sites.
@pchuri pchuri self-assigned this May 17, 2026
@pchuri pchuri merged commit 1539f2f into main May 17, 2026
6 checks passed
@pchuri pchuri deleted the refactor/extract-sanitize-filename branch May 17, 2026 12:35
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 2.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant