Skip to content

Ignore blank lines when reading TXT prompts#1480

Merged
romanlutz merged 1 commit intomicrosoft:mainfrom
biefan:fix-txt-reader-blank-lines
Mar 18, 2026
Merged

Ignore blank lines when reading TXT prompts#1480
romanlutz merged 1 commit intomicrosoft:mainfrom
biefan:fix-txt-reader-blank-lines

Conversation

@biefan
Copy link
Copy Markdown
Contributor

@biefan biefan commented Mar 16, 2026

Summary

  • skip blank and whitespace-only lines when parsing TXT prompt files
  • add a regression test covering mixed prompt and blank lines

Problem

pyrit.common.text_helper.read_txt() currently turns every input line into a prompt entry after strip(). This means blank lines are loaded as {"prompt": ""}, which silently injects empty prompts into TXT-backed datasets.

Testing

  • .venv/bin/pytest tests/unit/common/test_text_helper.py -q

@romanlutz romanlutz merged commit 6665bd4 into microsoft:main Mar 18, 2026
35 of 38 checks passed
riyosha pushed a commit to riyosha/PyRIT that referenced this pull request Mar 24, 2026
jbolor21 pushed a commit to jbolor21/jbolor-PyRIT that referenced this pull request Mar 25, 2026
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.

2 participants