1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Ensured uploaded system images remain public

Also added tests to cover local_secure image storage.

Fixes #725
This commit is contained in:
Dan Brown
2018-03-25 12:41:52 +01:00
parent f1586be516
commit 23f90ed6b4
5 changed files with 59 additions and 33 deletions

View File

@@ -11,11 +11,6 @@ class UploadService
*/
protected $fileSystem;
/**
* @var FileSystemInstance
*/
protected $storageInstance;
/**
* FileService constructor.
@@ -32,14 +27,8 @@ class UploadService
*/
protected function getStorage()
{
if ($this->storageInstance !== null) {
return $this->storageInstance;
}
$storageType = config('filesystems.default');
$this->storageInstance = $this->fileSystem->disk($storageType);
return $this->storageInstance;
return $this->fileSystem->disk($storageType);
}
/**
@@ -53,13 +42,4 @@ class UploadService
$folders = $this->getStorage()->directories($path);
return (count($files) === 0 && count($folders) === 0);
}
/**
* Check if using a local filesystem.
* @return bool
*/
protected function isLocal()
{
return strtolower(config('filesystems.default')) === 'local';
}
}