refactor: fs manager strings

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/672/head
Varun Patil 2023-05-22 21:06:22 -07:00
parent 1d1ba59ae2
commit 4bb41d1cc4
2 changed files with 9 additions and 2 deletions

View File

@ -41,6 +41,8 @@ class DownloadController extends GenericApiController
* @UseSession
*
* Request to download one or more files
*
* @param mixed $files
*/
public function request($files): Http\Response
{

View File

@ -71,7 +71,7 @@ class FsManager
$user = $this->userSession->getUser();
// Albums have no folder
if ($this->request->getParam('albums') && Util::albumsIsEnabled()) {
if ($this->hasAlbumToken() && Util::albumsIsEnabled()) {
if (null !== $user) {
return $root;
}
@ -243,7 +243,7 @@ class FsManager
{
try {
// Album share
if ($this->request->getParam('albums')) {
if ($this->hasAlbumToken()) {
$album = $this->albumsQuery->getAlbumByLink($this->getShareToken());
if (null === $album) {
return null;
@ -394,6 +394,11 @@ class FsManager
return $file;
}
private function hasAlbumToken(): bool
{
return null !== $this->request->getParam(\OCA\Memories\ClustersBackend\AlbumsBackend::clusterType(), null);
}
private function getShareToken()
{
return $this->request->getParam('token');