Skip to content

Conversation

@JonBasse
Copy link

@JonBasse JonBasse commented Feb 3, 2026

Summary

  • Add bounds checks before slicing date strings to prevent panics
  • Handle os.UserHomeDir() errors instead of silently ignoring them
  • Remove unused splitLabels() function

Changes

Panic prevention (commit 1)

  • internal/output/format.go: Add bounds check in WriteCompletedTasks() before slicing CompletedAt
  • cmd/todoist/view.go: Add bounds check before slicing PostedAt in comment display

Error handling improvement (commit 2)

  • internal/config/config.go: ConfigDir() and ConfigPath() now return (string, error) instead of just string
  • cmd/todoist/auth.go: Updated to handle new error returns from config functions

Dead code removal (commit 2)

  • cmd/todoist/update.go: Removed unused splitLabels() function and strings import

Test plan

  • Build passes (go build ./...)
  • Existing tests pass (go test ./...)

🤖 Generated with Claude Code

JonBasse and others added 2 commits February 3, 2026 09:35
Add bounds checks before slicing date strings to prevent panics when
CompletedAt or PostedAt fields are shorter than 10 characters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ConfigDir() and ConfigPath() now return errors instead of silently
  ignoring os.UserHomeDir() failures
- Update all call sites to handle the new error returns
- Remove unused splitLabels() function from update.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@JonBasse JonBasse force-pushed the fix/prevent-substring-panics branch from 5efd264 to 25b70cd Compare February 3, 2026 09:47
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.

1 participant