fix(core): resolve Windows line ending and path separation bugs across CLI (#21068)

This commit is contained in:
Muhammad Usman
2026-03-10 03:40:22 +05:00
committed by GitHub
parent 1fd42802be
commit f88488d1f9
4 changed files with 5 additions and 6 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ import fs from 'node:fs';
import fsPromises from 'node:fs/promises';
import path from 'node:path';
import type { PartUnion } from '@google/genai';
import mime from 'mime/lite';
import type { FileSystemService } from '../services/fileSystemService.js';
import { ToolErrorType } from '../tools/tool-error.js';
@@ -473,7 +472,7 @@ export async function processSingleFileContent(
case 'text': {
// Use BOM-aware reader to avoid leaving a BOM character in content and to support UTF-16/32 transparently
const content = await readFileWithEncoding(filePath);
const lines = content.split('\n');
const lines = content.split(/\r?\n/);
const originalLineCount = lines.length;
let sliceStart = 0;