mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-07 17:44:28 -07:00
This commit is contained in:
@@ -199,8 +199,8 @@ ${finalExclusionPatternsForDescription
|
||||
const fullPath = path.join(dir, normalizedP);
|
||||
let exists = false;
|
||||
try {
|
||||
await fsPromises.access(fullPath);
|
||||
exists = true;
|
||||
const st = await fsPromises.stat(fullPath);
|
||||
exists = st.isFile();
|
||||
} catch {
|
||||
exists = false;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ToolErrorType } from '../tools/tool-error.js';
|
||||
import { BINARY_EXTENSIONS } from './ignorePatterns.js';
|
||||
import { createRequire as createModuleRequire } from 'node:module';
|
||||
import { debugLogger } from './debugLogger.js';
|
||||
|
||||
import {
|
||||
DEFAULT_MAX_LINES_TEXT_FILE,
|
||||
MAX_LINE_LENGTH_TEXT_FILE,
|
||||
@@ -350,7 +351,9 @@ export async function isEmpty(filePath: string): Promise<boolean> {
|
||||
*/
|
||||
export async function isBinaryFile(filePath: string): Promise<boolean> {
|
||||
try {
|
||||
return await isBinaryFileCheck(filePath);
|
||||
const stats = await fsPromises.stat(filePath);
|
||||
if (!stats.isFile()) return false;
|
||||
return await isBinaryFileCheck(filePath, stats.size);
|
||||
} catch (error) {
|
||||
debugLogger.warn(
|
||||
`Failed to check if file is binary: ${filePath}`,
|
||||
|
||||
Reference in New Issue
Block a user