Skip to content

Commit

Permalink
Added check to see if disk implements a default visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko authored Jan 24, 2024
1 parent f4c61a9 commit d038681
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Database/Attach/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public function fromPost($uploadedFile)
? $uploadedFile->getPath() . DIRECTORY_SEPARATOR . $uploadedFile->getFileName()
: $uploadedFile->getRealPath();

$this->putFile($realPath, $this->disk_name);
if (!$this->putFile($realPath, $this->disk_name)) {
throw new SystemException('The file failed to be stored');

Check failure on line 123 in src/Database/Attach/File.php

View workflow job for this annotation

GitHub Actions / Code Analysis

Instantiated class Winter\Storm\Database\Attach\SystemException not found.

Check failure on line 123 in src/Database/Attach/File.php

View workflow job for this annotation

GitHub Actions / Code Analysis

Throwing object of an unknown class Winter\Storm\Database\Attach\SystemException.
}

return $this;
}
Expand Down Expand Up @@ -1008,7 +1010,11 @@ protected function copyStorageToLocal($storagePath, $localPath)
*/
protected function copyLocalToStorage($localPath, $storagePath)
{
return $this->getDisk()->put($storagePath, FileHelper::get($localPath), $this->isPublic() ? 'public' : null);
return $this->getDisk()->put(
$storagePath,
FileHelper::get($localPath),
$this->isPublic() ? ($this->getDisk()?->getConfig()['visibility'] ?? 'public') : null

Check failure on line 1016 in src/Database/Attach/File.php

View workflow job for this annotation

GitHub Actions / Code Analysis

Using nullsafe method call on non-nullable type Illuminate\Filesystem\FilesystemAdapter. Use -> instead.
);
}

//
Expand Down

0 comments on commit d038681

Please sign in to comment.