Skip to content

Commit 2870df3

Browse files
Handle invalid setting value, fallback to default value
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 6826442 commit 2870df3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/utils/fileUtils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ export async function loadWasmBinary(
5555

5656
// Text file read threshold - configurable via ENV, -1 to disable
5757
const DEFAULT_TEXT_FILE_READ_THRESHOLD_BYTES = 512 * 1024; // 512 KiB
58-
const TEXT_FILE_READ_THRESHOLD_BYTES = parseInt(
59-
process.env['GEMINI_TEXT_FILE_READ_THRESHOLD_BYTES'] ||
60-
String(DEFAULT_TEXT_FILE_READ_THRESHOLD_BYTES),
58+
const parsedThreshold = parseInt(
59+
process.env['GEMINI_TEXT_FILE_READ_THRESHOLD_BYTES'] ?? 'not-a-number',
6160
10,
6261
);
62+
const TEXT_FILE_READ_THRESHOLD_BYTES = isNaN(parsedThreshold)
63+
? DEFAULT_TEXT_FILE_READ_THRESHOLD_BYTES
64+
: parsedThreshold;
6365

6466
// Default values for encoding and separator format
6567
export const DEFAULT_ENCODING: BufferEncoding = 'utf-8';

0 commit comments

Comments
 (0)