Skip to content

Commit 87bf9f8

Browse files
feat(utils): consider empty buffers as text in isTextBuffer function
1 parent c30aeb0 commit 87bf9f8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/stores/buffers/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export function isTextBuffer(buffer: Uint8Array, sampleSize = 8000): boolean {
9696
const len = Math.min(buffer.length, sampleSize);
9797
let suspiciousBytes = 0;
9898
let i = 0;
99+
if (len === 0) return true; // Empty buffer is considered text
99100
while (i < len) {
100101
const byte = buffer[i];
101102
// Null bytes are almost never in text files

0 commit comments

Comments
 (0)