Skip to content

fix: Prevent multi-line titles and descriptions across commands#128

Merged
DylanDevelops merged 1 commit into
mainfrom
ravel/enforce-single-line-for-titles
Jun 7, 2026
Merged

fix: Prevent multi-line titles and descriptions across commands#128
DylanDevelops merged 1 commit into
mainfrom
ravel/enforce-single-line-for-titles

Conversation

@DylanDevelops

Copy link
Copy Markdown
Owner

Pull Request Checklist

  • I have read and followed the contribution guidelines.
  • My pull request targets the main branch of tmpo.
  • I have tested these changes locally on my machine.

Description

This pull request introduces a new utility function for input sanitization and consistently applies it across several commands to ensure user inputs are single-line, trimmed, and free of line breaks. The update improves input handling and prevents multi-line or malformed strings from being inadvertently processed. Comprehensive unit tests are also added to verify the correctness of the new sanitization logic.

Input sanitization improvements:

  • Added a new function SanitizeSingleLine in internal/ui/ui.go that replaces all newline and carriage return characters in a string with spaces and trims leading/trailing whitespace.
  • Replaced previous strings.TrimSpace calls with ui.SanitizeSingleLine for user inputs in cmd/entries/edit.go, cmd/entries/manual.go, cmd/milestones/start.go, and cmd/tracking/start.go to ensure consistent single-line input handling. [1] [2] [3] [4] [5]

Testing enhancements:

  • Added a comprehensive set of unit tests for SanitizeSingleLine in internal/ui/ui_test.go to cover various edge cases, including different types of whitespace and line breaks.

Dependency updates:

  • Imported the strings package in internal/ui/ui.go to support the new sanitization function.

@DylanDevelops DylanDevelops merged commit 6682a3d into main Jun 7, 2026
5 checks passed
@DylanDevelops DylanDevelops deleted the ravel/enforce-single-line-for-titles branch June 7, 2026 17:28
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