Skip to content

Commit cc2f8e7

Browse files
authored
Fix/duplicate bom (RooCodeInc#2651)
* fix: Prevent duplicate BOM in incoming content for DiffViewProvider * fix: Prevent duplicate BOM in changeset
1 parent 192a346 commit cc2f8e7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/dry-donuts-develop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
fix: Prevent duplicate BOM

src/integrations/editor/DiffViewProvider.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ export class DiffViewProvider {
7979
if (!this.relPath || !this.activeLineController || !this.fadedOverlayController) {
8080
throw new Error("Required values not set")
8181
}
82+
83+
// --- Fix to prevent duplicate BOM ---
84+
// Strip potential BOM from incoming content. VS Code's `applyEdit` might implicitly handle the BOM
85+
// when replacing from the start (0,0), and we want to avoid duplication.
86+
// Final BOM is handled in `saveChanges`.
87+
if (accumulatedContent.startsWith("\ufeff")) {
88+
accumulatedContent = accumulatedContent.slice(1) // Remove the BOM character
89+
}
90+
8291
this.newContent = accumulatedContent
8392
const accumulatedLines = accumulatedContent.split("\n")
8493
if (!isFinal) {

0 commit comments

Comments
 (0)