Repository navigation
fix(runner): decode input with a byte order mark - #2706
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Decoder and file iterator runner/runner.go |
Added decodeInput for UTF-8 BOM removal and UTF-16LE/BE conversion. Added inputFileLines for decoded file iteration and read-error handling. |
Runner integration and validation runner/runner.go, runner/targetline_test.go |
Updated file, glob, and stdin input paths to use decoded readers. Added tests for UTF-8, UTF-16LE, and UTF-16BE target files in file-loading and streaming modes. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Possibly related issues
- projectdiscovery/httpx#2703 — The change decodes UTF-16 input with a BOM for file, streaming, and stdin paths.
Possibly related PRs
- projectdiscovery/httpx#2691 — Both changes affect target-line parsing from runner file and stdin input paths.
- projectdiscovery/httpx#2668 — Both changes use the runner’s file and streaming input flow before target-line parsing.
Suggested reviewers: mazzz3r, mzack9999
Merge Risk: 
Minimal · up to 53b37
-
The reported fixture problem does not block the BOM input change. No actionable merge-blocking risk remains after normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title "fix(runner): decode input with a byte order mark" matches the main change. The runner now decodes UTF-16 input with a BOM to UTF-8 and strips the UTF-8 BOM for file loading, streaming, and stdin. The title is specific and concise, and it identifies the primary change from the developer's perspective. The summary also covers the added test for BOM handling, which the title does not need to mention.
Full details: Linked Issues check
-
Explanation
Issue
#2703requires UTF-16 input files to be decoded so target lines can be processed.decodeInputusesunicode.BOMOverridefor UTF-16 BOM detection and UTF-8 BOM removal.loadAndCloseFileapplies it to-linput.inputFileLinesapplies it to streamed files. The stdin path also applies it.TestRunner_readsInputWithBOMcovers UTF-16LE, UTF-16BE, and UTF-8 BOM input for-land-stream.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue
#2703and the stated input coverage. The new streaming iterator is required to decode streamed files and preserve read errors. The added tests verify the input decoding behavior. No unrelated product behavior is changed.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
A rabbit reads bytes by the moonlit trail
UTF-8 and UTF-16 now tell the tale
BOMs hop softly out of sight
Two target lines arrive just right
Files and stdin share the way
The runner bounds through dawn-lit hay
Fixes #2703
Input starting with a UTF-16 BOM (Windows PowerShell output) is decoded to UTF-8, and a UTF-8 BOM is stripped, for
-l,-streamand stdin.Summary by CodeRabbit