Skip to content
Snippets Groups Projects
Commit 3a66b7c6 authored by Lukas Reschke's avatar Lukas Reschke
Browse files

Merge pull request #13479 from owncloud/issue/13475-favorites-and-unavailable-external-storages

Ignore favorites that are not available when creating the favorites list
parents 10b03051 7e6d2c73
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ class ApiController extends Controller { ...@@ -67,6 +67,7 @@ class ApiController extends Controller {
* *
* @param string $path path * @param string $path path
* @param array $tags array of tags * @param array $tags array of tags
* @return DataResponse
*/ */
public function updateFileTags($path, $tags = null) { public function updateFileTags($path, $tags = null) {
$result = array(); $result = array();
...@@ -76,6 +77,10 @@ class ApiController extends Controller { ...@@ -76,6 +77,10 @@ class ApiController extends Controller {
$this->tagService->updateFileTags($path, $tags); $this->tagService->updateFileTags($path, $tags);
} catch (\OCP\Files\NotFoundException $e) { } catch (\OCP\Files\NotFoundException $e) {
return new DataResponse($e->getMessage(), Http::STATUS_NOT_FOUND); return new DataResponse($e->getMessage(), Http::STATUS_NOT_FOUND);
} catch (\OCP\Files\StorageNotAvailableException $e) {
return new DataResponse($e->getMessage(), Http::STATUS_SERVICE_UNAVAILABLE);
} catch (\Exception $e) {
return new DataResponse($e->getMessage(), Http::STATUS_NOT_FOUND);
} }
$result['tags'] = $tags; $result['tags'] = $tags;
} }
...@@ -89,6 +94,7 @@ class ApiController extends Controller { ...@@ -89,6 +94,7 @@ class ApiController extends Controller {
* @CORS * @CORS
* *
* @param array $tagName tag name to filter by * @param array $tagName tag name to filter by
* @return DataResponse
*/ */
public function getFilesByTag($tagName) { public function getFilesByTag($tagName) {
$files = array(); $files = array();
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
namespace OCA\Files\Service; namespace OCA\Files\Service;
use OC\Files\FileInfo;
/** /**
* Service class to manage tags on files. * Service class to manage tags on files.
*/ */
...@@ -84,11 +86,19 @@ class TagService { ...@@ -84,11 +86,19 @@ class TagService {
$nodes = $this->homeFolder->searchByTag( $nodes = $this->homeFolder->searchByTag(
$tagName, $this->userSession->getUser()->getUId() $tagName, $this->userSession->getUser()->getUId()
); );
foreach ($nodes as &$node) { $fileInfos = [];
$node = $node->getFileInfo(); foreach ($nodes as $node) {
try {
/** @var \OC\Files\Node\Node $node */
$fileInfos[] = $node->getFileInfo();
} catch (\Exception $e) {
// FIXME Should notify the user, when this happens
// Can not get FileInfo, maybe the connection to the external
// storage is interrupted.
}
} }
return $nodes; return $fileInfos;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment