summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-01-23 11:44:54 +0100
committerLukas Reschke <lukas@owncloud.com>2015-01-23 11:44:54 +0100
commit3a66b7c6eca7a7b841ec8c15c59f691d3079afab (patch)
tree4bbe67851f4fc3b851b2adb060c42a0034371642
parent10b03051f8f80601a6c1bb80c182a5a09ed4bea4 (diff)
parent7e6d2c73d22f919229bd955b2fd6a9aa2973791e (diff)
downloadnextcloud-server-3a66b7c6eca7a7b841ec8c15c59f691d3079afab.tar.gz
nextcloud-server-3a66b7c6eca7a7b841ec8c15c59f691d3079afab.zip
Merge pull request #13479 from owncloud/issue/13475-favorites-and-unavailable-external-storages
Ignore favorites that are not available when creating the favorites list
-rw-r--r--apps/files/controller/apicontroller.php6
-rw-r--r--apps/files/service/tagservice.php16
2 files changed, 19 insertions, 3 deletions
diff --git a/apps/files/controller/apicontroller.php b/apps/files/controller/apicontroller.php
index 902731a0492..a8bea27e4bb 100644
--- a/apps/files/controller/apicontroller.php
+++ b/apps/files/controller/apicontroller.php
@@ -67,6 +67,7 @@ class ApiController extends Controller {
*
* @param string $path path
* @param array $tags array of tags
+ * @return DataResponse
*/
public function updateFileTags($path, $tags = null) {
$result = array();
@@ -76,6 +77,10 @@ class ApiController extends Controller {
$this->tagService->updateFileTags($path, $tags);
} catch (\OCP\Files\NotFoundException $e) {
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;
}
@@ -89,6 +94,7 @@ class ApiController extends Controller {
* @CORS
*
* @param array $tagName tag name to filter by
+ * @return DataResponse
*/
public function getFilesByTag($tagName) {
$files = array();
diff --git a/apps/files/service/tagservice.php b/apps/files/service/tagservice.php
index 86885e38ddd..fe26838552a 100644
--- a/apps/files/service/tagservice.php
+++ b/apps/files/service/tagservice.php
@@ -8,6 +8,8 @@
namespace OCA\Files\Service;
+use OC\Files\FileInfo;
+
/**
* Service class to manage tags on files.
*/
@@ -84,11 +86,19 @@ class TagService {
$nodes = $this->homeFolder->searchByTag(
$tagName, $this->userSession->getUser()->getUId()
);
- foreach ($nodes as &$node) {
- $node = $node->getFileInfo();
+ $fileInfos = [];
+ 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;
}
}