Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 15, 2025

Adds regression test for PR #272389 which fixed files with BOM (\uFEFF) characters in filenames failing to open. The bug occurred because TextDecoder was stripping BOM during IPC message deserialization.

Test Coverage

The test verifies VSBuffer.toString() preserves BOM characters:

test('issue #251527 - VSBuffer#toString preserves BOM character in filenames', () => {
    const bomChar = '\uFEFF';
    const filename = `${bomChar}c.txt`;
    const buffer = VSBuffer.fromString(filename);
    const result = buffer.toString();

    assert.strictEqual(result, filename);
    assert.strictEqual(result.charCodeAt(0), 0xFEFF);
});

Without the fix (ignoreBOM: true in TextDecoder constructor), this test fails as the BOM is stripped from the filename.

Fixes #251527

Original prompt

Add a test for the fix in #251527


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add test for the fix in issue #251527 Add test for BOM character preservation in VSBuffer (issue #251527) Nov 15, 2025
Copilot AI requested a review from bpasero November 15, 2025 08:23
Copilot finished work on behalf of bpasero November 15, 2025 08:23
@bpasero bpasero marked this pull request as ready for review November 15, 2025 17:42
Copilot AI review requested due to automatic review settings November 15, 2025 17:42
@bpasero bpasero enabled auto-merge (squash) November 15, 2025 17:43
@bpasero bpasero added this to the November 2025 milestone Nov 15, 2025
Copilot finished reviewing on behalf of bpasero November 15, 2025 17:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a regression test for issue #251527, which involved files with BOM (\uFEFF) characters in filenames failing to open due to TextDecoder stripping the BOM during IPC message deserialization. The test validates that VSBuffer.toString() now preserves BOM characters after the fix (adding ignoreBOM: true to the TextDecoder constructor).

Key Changes

  • Added test case issue #251527 - VSBuffer#toString preserves BOM character in filenames to verify BOM preservation
  • Test creates a buffer from a string containing BOM character and validates it's preserved through serialization/deserialization

@bpasero
Copy link
Member

bpasero commented Nov 17, 2025

@microsoft-github-policy-service rerun

@bpasero bpasero merged commit fafe725 into main Nov 17, 2025
28 checks passed
@bpasero bpasero deleted the copilot/add-test-for-fix-251527 branch November 17, 2025 06:16
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.

Cannot open files that contains zero width chars

3 participants