Preserve statistics on reset failures and reject invalid accounting data

This commit is contained in:
Sucukdeluxe committed 2026-10-24 13:26:41 +02:00
1 parent a4ac70a276
commit a749ef5c15
2 files changed
+77 -31

No files matched your search

+2 -2
View File
@@ -135,8 +135,8 @@ class UploadManager extends EventEmitter {
}
_recordTransferred(entry, bytes, total) {
if (!Number.isFinite(bytes) || bytes < 0) return;
const next = Math.min(bytes, total);
if (!Number.isFinite(bytes) || bytes < 0 || !Number.isFinite(total) || total < 0) return;
const next = Math.max(entry.bytesUploaded || 0, Math.min(bytes, total));
const delta = Math.max(0, next - entry.bytesUploaded);
this.transferredBytes += delta;
if (delta > 0) this.emit('statistics-transfer', { hoster: entry.hoster, bytes: delta });