Skip to content

Commit

Permalink
Merge pull request #65 from pusherman/master
Browse files Browse the repository at this point in the history
(task) check response from writeStream to verify write was successful
  • Loading branch information
Sammyjo20 authored Jun 10, 2022
2 parents eb2c92b + 764665d commit 91b4bca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Helpers/Cloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Sammyjo20\Lasso\Helpers;

use Illuminate\Support\Facades\Storage;
use League\Flysystem\UnableToWriteFile;
use Sammyjo20\Lasso\Exceptions\ConsoleMethodException;
use Sammyjo20\Lasso\Helpers\Filesystem as LocalFilesystem;

Expand Down Expand Up @@ -64,7 +65,9 @@ public function uploadFile(string $path, string $name): void
$stream = fopen($path, 'rb');

// Use the stream to write the bundle to the Filesystem.
$this->cloudFilesystem->writeStream($upload_path, $stream);
if ($this->cloudFilesystem->writeStream($upload_path, $stream) === false) {
throw new UnableToWriteFile("Unable to write file at location " . $upload_path);
}

// Close the Stream pointer because it's good practice.
if (is_resource($stream)) {
Expand Down

0 comments on commit 91b4bca

Please sign in to comment.