fix: corrupted binary downloads (#634)

- The existing setup was using the text reader endpoint for downloading
files `fsPromises.readFile(..., 'utf8')` at line 801. This was incorrect

- In the old Files tab flow, the client then took that decoded string
and rebuilt it as a text blob. That UTF-8 decode/re-encode step changes
raw bytes, so the downloaded file no longer matches the original.
Folder ZIP export had the same problem for any binary file inside the
archive.

Co-authored-by: Haileyesus <something@gmail.com>
This commit is contained in:
Haile
2026-04-10 13:35:23 +03:00
committed by GitHub
parent 388134c7a5
commit e61f8a543d
3 changed files with 37 additions and 37 deletions

View File

@@ -111,6 +111,8 @@ export const api = {
}),
readFile: (projectName, filePath) =>
authenticatedFetch(`/api/projects/${projectName}/file?filePath=${encodeURIComponent(filePath)}`),
readFileBlob: (projectName, filePath) =>
authenticatedFetch(`/api/projects/${projectName}/files/content?path=${encodeURIComponent(filePath)}`),
saveFile: (projectName, filePath, content) =>
authenticatedFetch(`/api/projects/${projectName}/file`, {
method: 'PUT',
@@ -242,4 +244,4 @@ export const api = {
method: 'DELETE',
...options,
}),
};
};