fix(fs): off by one error in readTextFileLines (#3155)

* fix: off by one error in readTextFileLines (#3154)

Signed-off-by: EliasStar <31409841+EliasStar@users.noreply.github.com>

* Format and regenerate `api-iife.js`

---------

Signed-off-by: EliasStar <31409841+EliasStar@users.noreply.github.com>
Co-authored-by: Tony <legendmastertony@gmail.com>
This commit is contained in:
Elias*
2025-12-09 04:48:18 +01:00
committed by GitHub
parent e4a40f4423
commit 521cd8b372
3 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
---
"fs": patch
"fs-js": patch
---
Fix off by one error in the implementation of readTextFileLines causing all lines to end with an (additional) null byte.
Issue: [#3154](https://github.com/tauri-apps/plugins-workspace/issues/3154)
PR: [#3155](https://github.com/tauri-apps/plugins-workspace/pull/3155)

File diff suppressed because one or more lines are too long

View File

@@ -838,7 +838,9 @@ async function readTextFileLines(
return { value: null, done }
}
const line = new TextDecoder().decode(bytes.slice(0, bytes.byteLength))
const line = new TextDecoder().decode(
bytes.slice(0, bytes.byteLength - 1)
)
return {
value: line,