From 642e62551b2c325f9ae1a15b9dcf18713e8a18ad Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 22 Nov 2024 18:32:36 +0000 Subject: [PATCH] Add proper exception for uploads of empty files --- src/MTProtoTools/Files.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MTProtoTools/Files.php b/src/MTProtoTools/Files.php index 9d8603a3c..732cb735e 100644 --- a/src/MTProtoTools/Files.php +++ b/src/MTProtoTools/Files.php @@ -393,6 +393,9 @@ trait Files } await($promises, $cancellation); await($resPromises, $cancellation); + if ($totalSize === 0) { + throw new AssertionError('You uploaded an empty file!'); + } $time = microtime(true) - $start; $speed = (int) ($totalSize * 8 / $time) / 1000000; if (!$size) {