fix(git-sync): skip binary files on push to prevent git server OOM
Build and Deploy Verso / deploy (push) Has been cancelled

Binary files (images, PDFs, etc.) from getAllFiles are now filtered
through isTextFile before being written to the git working tree.
Text-typed uploaded files (.bib, .cls, .sty) are still pushed; binary
assets are excluded.

Git packs binary files uncompressed and the resulting packfile is
processed fully in memory by the receiving server (git-receive-pack).
Even a handful of images is enough to OOM a memory-constrained Gitea
pod. Binary assets belong in Git LFS or object storage, not in a
regular git object store.

The widget description now explicitly states that binary files are
excluded from the push.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-24 08:03:46 +00:00
co-authored by Claude Sonnet 4.6
parent e35c8e7a45
commit 33ed7487b8
3 changed files with 6 additions and 2 deletions
@@ -145,8 +145,12 @@ async function pushToRemote(
await writeFile(dest, doc.lines.join('\n'))
}
// Only push text-typed uploaded files (e.g. .bib, .cls, .sty).
// Binary files (images, PDFs, etc.) are skipped — git packs them
// uncompressed, causing large packfiles that OOM the git server.
const files = await ProjectEntityHandler.promises.getAllFiles(projectId)
for (const [path, file] of Object.entries(files)) {
if (!isTextFile(basename(path))) continue
const rel = path.startsWith('/') ? path.slice(1) : path
const dest = join(fileRoot, rel)
await mkdir(dirname(dest), { recursive: true })
+1 -1
View File
@@ -1044,7 +1044,7 @@
"git_bridge_modal_learn_more_about_authentication_tokens": "Learn more about Git integration authentication tokens.",
"git_bridge_modal_read_only": "<strong>You have read-only access to this project.</strong> This means you can pull from __appName__ but you cant push any changes you make back to this project.",
"git_sync": "Git Sync",
"git_sync_description": "Force-push your project files to an external git repository. Include your auth token in the URL (e.g. https://user:token@github.com/org/repo.git).",
"git_sync_description": "Sync your project with an external git repository. Binary files (images, etc.) are excluded from the push — git is not suited for binary assets. Include your auth token in the URL.",
"git_sync_pull_now": "Pull from git",
"git_sync_pull_success": "Project updated from git remote successfully.",
"git_sync_pulling": "Pulling…",
+1 -1
View File
@@ -1047,7 +1047,7 @@
"git_bridge_modal_learn_more_about_authentication_tokens": "Apprenez-en davantage sur les jetons dauthentification de lintégration Git.",
"git_bridge_modal_read_only": "<strong>Vous disposez d'un accès en lecture seule à ce projet.</strong> Cela signifie que vous pouvez extraire des données de __appName__, mais que vous ne pouvez pas transférer les modifications que vous apportez à ce projet.",
"git_sync": "Synchronisation Git",
"git_sync_description": "Pousse de force les fichiers du projet vers un dépôt git externe. Incluez votre jeton d'authentification dans l'URL (ex. https://user:token@github.com/org/repo.git).",
"git_sync_description": "Synchronisez votre projet avec un dépôt git externe. Les fichiers binaires (images, etc.) sont exclus de la poussée — git n'est pas adapté aux ressources binaires. Incluez votre jeton d'authentification dans l'URL.",
"git_sync_pull_now": "Tirer depuis git",
"git_sync_pull_success": "Projet mis à jour depuis le dépôt git avec succès.",
"git_sync_pulling": "Récupération…",