Skip to content

fix: Prevent unexpected newline in output for empty files#35

Merged
supitsdu merged 2 commits intomainfrom
fix/unexpect-newline
Jun 30, 2024
Merged

fix: Prevent unexpected newline in output for empty files#35
supitsdu merged 2 commits intomainfrom
fix/unexpect-newline

Conversation

@supitsdu
Copy link
Copy Markdown
Owner

@supitsdu supitsdu commented Jun 30, 2024

Modified ReadContentConcurrently and AggregateContent functions in reader package to handle empty content scenarios gracefully. ReadContentConcurrently now checks for empty content before appending to results, ensuring only valid content is processed. AggregateContent skips appending newline separators for empty content, addressing the issue where empty files would erroneously contribute newlines to the final output.

  • Review the unit tests for ParseContent to ensure they cover the case of empty file input.
  • Consider adding a test specifically for this scenario to prevent regressions in the future.

Closes #31

Modified ReadContentConcurrently and AggregateContent functions in reader package to handle empty content scenarios gracefully. ReadContentConcurrently now checks for empty content before appending to results, ensuring only valid content is processed. AggregateContent skips appending newline separators for empty content, addressing the issue where empty files would erroneously contribute newlines to the final output.

- [x] Review the unit tests for ParseContent to ensure they cover the case of empty file input.
- [ ] Consider adding a test specifically for this scenario to prevent regressions in the future.

Closes #31
@supitsdu supitsdu added enhancement New feature requests or enhancements. cleanup Minor changes to remove dead code, fix inconsistencies, etc. labels Jun 30, 2024
Updated tests in reader_test.go to include checks for handling empty files in ParseContent function of reader package. Added tests to verify that ParseContent correctly returns an empty string when provided with an empty file path and a newline character string. This ensures consistent behavior and addresses potential issues highlighted in #31.
@supitsdu supitsdu merged commit a1e6216 into main Jun 30, 2024
@supitsdu supitsdu deleted the fix/unexpect-newline branch June 30, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Minor changes to remove dead code, fix inconsistencies, etc. enhancement New feature requests or enhancements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Unexpected Newline in Output when Copying Empty Files

1 participant