Skip to content

Conversation

@busorgin
Copy link
Contributor

Fix for #251527

Issue can be replicated with the steps shown in the issue.

DiskFileSystemProvider.readdir() will create a promise which will contain the list of files in our folder, this message is serialized correctly with the BOM character preserved. The issue occurs when ChannelClient.onBuffer() tries to deserialize the message. In VSBuffer.toString() a default instance of TextDecoder is used which has ignoreBOM set to false meaning the BOM character will be stripped.

Copilot AI review requested due to automatic review settings October 21, 2025 02:06
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 fixes a bug where the Byte Order Mark (BOM) character was being incorrectly stripped during message deserialization in VSBuffer.toString(). The fix ensures the BOM character is preserved by explicitly setting ignoreBOM: true when creating the TextDecoder instance.

Key Changes:

  • Modified TextDecoder instantiation to preserve BOM characters during UTF-8 decoding

@bpasero bpasero added this to the November 2025 milestone Nov 14, 2025
@bpasero
Copy link
Member

bpasero commented Nov 14, 2025

Great finding! Our original intent with buffer.ts was to stay as close as possible to node.js, so this makes sense.

One change I push is to leave the encoding not spelled out explicitly and rely on the default: bef678a

@bpasero bpasero enabled auto-merge (squash) November 14, 2025 19:03
@bpasero bpasero merged commit 19a815a into microsoft:main Nov 14, 2025
17 checks passed
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.

4 participants