From e91dcee0eac21199c4156f455afcee238a1ed1d9 Mon Sep 17 00:00:00 2001 From: Diocrafts Date: Sun, 12 Apr 2026 00:29:34 +0200 Subject: [PATCH] fix: scale folder upload timeout by file size (fixes #249) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The folder upload path (uploadFolderEntries) used a flat 10s fetch timeout for all files regardless of size. Large files like .CR2 RAW images (~25MB) on slower networks (e.g. Raspberry Pi) exceeded this timeout, causing the AbortController to kill the request before the server received the full body — hence no server logs and 'unknown error' on the frontend. Changed to size-scaled timeout: 30s base + 2s per MB (min 10s). A 25MB CR2 now gets ~80s instead of 10s. --- README.md | 3 --- static/js/features/files/fileOperations.js | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dccc38af..263194ae 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,7 @@ [![Last Commit](https://img.shields.io/github/last-commit/diocrafts/OxiCloud?style=for-the-badge)](https://github.com/diocrafts/OxiCloud/commits/main) [**Documentation**](https://diocrafts.github.io/OxiCloud/) | [**Quick Start**](#-quick-start) -
-**English** | [Español](docs/es/) - NextCloud was too slow on my home server. So I built OxiCloud — a complete cloud platform written in Rust that runs on minimal hardware and stays out of your way. diff --git a/static/js/features/files/fileOperations.js b/static/js/features/files/fileOperations.js index c7aa9128..b7e0cc71 100644 --- a/static/js/features/files/fileOperations.js +++ b/static/js/features/files/fileOperations.js @@ -549,7 +549,9 @@ const fileOps = { // so all files reaching fetch() are regular. Keep-alive // reuses TCP connections across workers for speed. const CONCURRENCY = 10; - const TIMEOUT_MS = 10000; // 10s for normal files + const TIMEOUT_BASE_MS = 30000; // 30s base for normal files + const TIMEOUT_PER_MB_MS = 2000; // +2s per MB (supports ≥4 Mbps) + const TIMEOUT_MIN_MS = 10000; // floor for tiny files const TIMEOUT_MS_ZERO = 3000; // 3s for 0-byte files const uploadOneFile = async (idx) => { @@ -596,7 +598,9 @@ const fileOps = { formData.append('folder_id', targetFolderId); formData.append('file', uploadFile, file.name); - const thisTimeout = file.size === 0 ? TIMEOUT_MS_ZERO : TIMEOUT_MS; + const thisTimeout = file.size === 0 + ? TIMEOUT_MS_ZERO + : Math.max(TIMEOUT_MIN_MS, TIMEOUT_BASE_MS + Math.ceil(file.size / (1024 * 1024)) * TIMEOUT_PER_MB_MS); console.log(`[UPLOAD START] #${idx} ${rel} (${file.size} bytes, timeout=${thisTimeout}ms)`); result = await this._uploadFileFetch(formData, thisTimeout);