Repository navigation
Add tests verifying empty lines in manifest values are sanitized - #392
Merged
Merged
Conversation
MSHARED-815 fixed sanitization of newlines in manifest entry values, but the existing tests only covered single newlines. Add tests that verify: - Multiple consecutive empty lines (\\n\\n) are sanitized and subsequent manifest entries remain readable - CRLF empty lines (\\r\\n\\r\\n) are sanitized correctly - Bare CR sequences (\\r\\r) are sanitized correctly These tests confirm that the manifest file produced is valid and can be read back without IOException. Closes #225
slachiewicz
approved these changes
Aug 25, 2026
This was referenced Sep 19, 2026
slachiewicz
added a commit
that referenced
this pull request
Sep 20, 2026
Backport of f2135b1 (#363) and 89d3f0f (#392) from master. Newlines in a manifest entry value produce an invalid MANIFEST.MF: an empty line ends the main section and the entries after it are lost. Replace CR, LF and CRLF with a space before the value is stored, in the main attributes and in the named sections.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fix for MSHARED-815 (commit
f2135b1) already sanitizes newlines in manifest entry values. The existing tests cover single\nand\r\nbut not multiple consecutive empty lines or bare CR sequences.Added two tests that verify the fix handles these edge cases:
manifestEntryWithMultipleEmptyLinesDoesNotCorruptSubsequentEntries-- verifies that values with multiple\n\nempty lines are sanitized and subsequent manifest entries remain readablemanifestEntryWithCRLFEmptyLinesDoesNotCorruptManifest-- verifies\r\n\r\nand\r\rsequences are sanitized correctlyBoth tests write a JAR, read the manifest back, and verify the attributes are correct and the manifest is valid. All 86 tests pass.
Closes #225