Skip to content

Fix IndexError in strip_quoted_wrapping for filename-only content#5355

Open
ikatyal2110 wants to merge 1 commit into
Aider-AI:mainfrom
ikatyal2110:fix-strip-quoted-wrapping-indexerror
Open

Fix IndexError in strip_quoted_wrapping for filename-only content#5355
ikatyal2110 wants to merge 1 commit into
Aider-AI:mainfrom
ikatyal2110:fix-strip-quoted-wrapping-indexerror

Conversation

@ikatyal2110

Copy link
Copy Markdown

strip_quoted_wrapping raised IndexError when a block's content was just a filename line — after dropping that line res is empty, and the fence check then indexed res[0]/res[-1]. Added the same 'if res' guard the trailing-newline check right below it already uses, plus a test. This may be the cause of #3855.

When a block's content is just the filename line, stripping that line leaves
res empty, and the fence check then indexed res[0]/res[-1] on an empty list
and raised IndexError. Guard it with `if res`, like the trailing-newline
check right below already does.
@ikatyal2110 ikatyal2110 marked this pull request as ready for review June 30, 2026 02:33
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