From adb3f1e26f1f6071d96a2b05f619c9877496765c Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sun, 3 Dec 2023 17:51:49 +0100 Subject: [PATCH] Move the code deeper near to the use --- src/Resumable.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Resumable.php b/src/Resumable.php index 8a5a138..91f7b96 100644 --- a/src/Resumable.php +++ b/src/Resumable.php @@ -273,13 +273,12 @@ public function handleChunk() $chunkSize = (int) $this->resumableParam($this->resumableOption['chunkSize']); $totalSize = (int) $this->resumableParam($this->resumableOption['totalSize']); - if (!$this->isChunkUploaded($identifier, $filename, $chunkNumber)) { - $chunkDir = $this->tmpChunkDir($identifier) . DIRECTORY_SEPARATOR; - $chunkFile = $chunkDir . $this->tmpChunkFilename($filename, $chunkNumber); - + if (! $this->isChunkUploaded($identifier, $filename, $chunkNumber)) { if (count($files) > 0) { $firstFile = array_shift($files); if ($firstFile instanceof UploadedFileInterface) { + $chunkDir = $this->tmpChunkDir($identifier) . DIRECTORY_SEPARATOR; + $chunkFile = $chunkDir . $this->tmpChunkFilename($filename, $chunkNumber); $this->log('Moving chunk ' . $chunkNumber . ' for ' . $identifier); $firstFile->moveTo($chunkFile); } else {