aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-04-26 01:28:16 -0300
committerGitHub <noreply@github.com>2017-04-26 01:28:16 -0300
commit527369be9c92d7574dbfbd35ab833e6f6b557ba3 (patch)
tree0a48b35bd8ee4233a3b85d59c481a0e802fe3d38 /apps
parent4c2c08f376da6c8229522559ca3b6c9c7d0f5358 (diff)
parent1c40a0520403f84ec72b5925d9218c54987dc37b (diff)
downloadnextcloud-server-527369be9c92d7574dbfbd35ab833e6f6b557ba3.tar.gz
nextcloud-server-527369be9c92d7574dbfbd35ab833e6f6b557ba3.zip
Merge pull request #4500 from nextcloud/downstream-27118
Restrict proppatch to the proper nodes
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php17
-rw-r--r--apps/dav/lib/Connector/Sabre/TagsPlugin.php17
-rw-r--r--apps/dav/lib/SystemTag/SystemTagPlugin.php12
3 files changed, 20 insertions, 26 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index 5a08e37a153..1b1f43df9ea 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -386,25 +386,22 @@ class FilesPlugin extends ServerPlugin {
* @return void
*/
public function handleUpdateProperties($path, PropPatch $propPatch) {
- $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function($time) use ($path) {
+ $node = $this->tree->getNodeForPath($path);
+ if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
+ return;
+ }
+
+ $propPatch->handle(self::LASTMODIFIED_PROPERTYNAME, function($time) use ($node) {
if (empty($time)) {
return false;
}
- $node = $this->tree->getNodeForPath($path);
- if (is_null($node)) {
- return 404;
- }
$node->touch($time);
return true;
});
- $propPatch->handle(self::GETETAG_PROPERTYNAME, function($etag) use ($path) {
+ $propPatch->handle(self::GETETAG_PROPERTYNAME, function($etag) use ($node) {
if (empty($etag)) {
return false;
}
- $node = $this->tree->getNodeForPath($path);
- if (is_null($node)) {
- return 404;
- }
if ($node->setEtag($etag) !== -1) {
return true;
}
diff --git a/apps/dav/lib/Connector/Sabre/TagsPlugin.php b/apps/dav/lib/Connector/Sabre/TagsPlugin.php
index 59e4ab4546d..490501a0011 100644
--- a/apps/dav/lib/Connector/Sabre/TagsPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/TagsPlugin.php
@@ -267,20 +267,17 @@ class TagsPlugin extends \Sabre\DAV\ServerPlugin
* @return void
*/
public function handleUpdateProperties($path, PropPatch $propPatch) {
- $propPatch->handle(self::TAGS_PROPERTYNAME, function($tagList) use ($path) {
- $node = $this->tree->getNodeForPath($path);
- if (is_null($node)) {
- return 404;
- }
+ $node = $this->tree->getNodeForPath($path);
+ if (!($node instanceof \OCA\DAV\Connector\Sabre\Node)) {
+ return;
+ }
+
+ $propPatch->handle(self::TAGS_PROPERTYNAME, function($tagList) use ($node) {
$this->updateTags($node->getId(), $tagList->getTags());
return true;
});
- $propPatch->handle(self::FAVORITE_PROPERTYNAME, function($favState) use ($path) {
- $node = $this->tree->getNodeForPath($path);
- if (is_null($node)) {
- return 404;
- }
+ $propPatch->handle(self::FAVORITE_PROPERTYNAME, function($favState) use ($node) {
if ((int)$favState === 1 || $favState === 'true') {
$this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE);
} else {
diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php
index d76bf2e689b..98c730906c6 100644
--- a/apps/dav/lib/SystemTag/SystemTagPlugin.php
+++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php
@@ -268,17 +268,17 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin {
* @return void
*/
public function handleUpdateProperties($path, PropPatch $propPatch) {
+ $node = $this->server->tree->getNodeForPath($path);
+ if (!($node instanceof SystemTagNode)) {
+ return;
+ }
+
$propPatch->handle([
self::DISPLAYNAME_PROPERTYNAME,
self::USERVISIBLE_PROPERTYNAME,
self::USERASSIGNABLE_PROPERTYNAME,
self::GROUPS_PROPERTYNAME,
- ], function($props) use ($path) {
- $node = $this->server->tree->getNodeForPath($path);
- if (!($node instanceof SystemTagNode)) {
- return;
- }
-
+ ], function($props) use ($node) {
$tag = $node->getSystemTag();
$name = $tag->getName();
$userVisible = $tag->isUserVisible();