Skip to content

Commit

Permalink
Add proper exception for uploads of empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 22, 2024
1 parent 314db4e commit 642e625
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/MTProtoTools/Files.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ public function uploadFromCallable(callable $callable, int $size = 0, string $mi
}
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) {
Expand Down

0 comments on commit 642e625

Please sign in to comment.