From 1a58426e37198adfee7216bd84c9589e87fc79f5 Mon Sep 17 00:00:00 2001 From: Fredrik Date: Sun, 26 Mar 2023 16:15:04 +0200 Subject: [PATCH] Fix issue w tiny upload session not being finalized. --- src/SharePoint/UploadSession.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SharePoint/UploadSession.php b/src/SharePoint/UploadSession.php index 87a4f23f..0eb3e5ac 100644 --- a/src/SharePoint/UploadSession.php +++ b/src/SharePoint/UploadSession.php @@ -44,12 +44,13 @@ function buildQuery($files, $sourcePath, $targetFileName, callable $chunkUpload if ($firstChunk) { $uploadFile->startUpload($this->uploadSessionId, $buffer); $firstChunk = false; - } elseif ($fileSize == $bytesRead) { - $this->targetFile = $uploadFile->finishUpload($this->uploadSessionId,$offset, $buffer); } else { $uploadFile->continueUpload($this->uploadSessionId,$offset, $buffer); } $offset = $bytesRead; + if ($fileSize == $bytesRead) { + $this->targetFile = $uploadFile->finishUpload($this->uploadSessionId,$offset, ''); + } } fclose($handle);