summaryrefslogtreecommitdiffstats
path: root/core/Controller/NavigationController.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-03-05 12:19:20 +0100
committerJulius Härtl <jus@bitgrid.net>2018-03-05 12:19:20 +0100
commit723b8764d111fd414cf2e37ae06e0b9a29c9dff7 (patch)
tree56d532655a7fe1785cec336c81eed03b41256848 /core/Controller/NavigationController.php
parent3ced2c7ab25ae6c7f64d96a4b16754f902a9689f (diff)
downloadnextcloud-server-723b8764d111fd414cf2e37ae06e0b9a29c9dff7.tar.gz
nextcloud-server-723b8764d111fd414cf2e37ae06e0b9a29c9dff7.zip
Add ETag to NavigationController
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/Controller/NavigationController.php')
-rw-r--r--core/Controller/NavigationController.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php
index 3521fac3b46..b178cb97cd5 100644
--- a/core/Controller/NavigationController.php
+++ b/core/Controller/NavigationController.php
@@ -22,6 +22,7 @@
*/
namespace OC\Core\Controller;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\INavigationManager;
@@ -54,7 +55,14 @@ class NavigationController extends OCSController {
if ($absolute) {
$navigation = $this->rewriteToAbsoluteUrls($navigation);
}
- return new DataResponse($navigation);
+
+ $etag = md5(json_encode($navigation));
+ if ($this->request->getHeader('If-None-Match') === $etag) {
+ return new DataResponse([], Http::STATUS_NOT_MODIFIED);
+ }
+ $response = new DataResponse($navigation);
+ $response->setEtag($etag);
+ return $response;
}
/**
@@ -69,7 +77,13 @@ class NavigationController extends OCSController {
if ($absolute) {
$navigation = $this->rewriteToAbsoluteUrls($navigation);
}
- return new DataResponse($navigation);
+ $etag = md5(json_encode($navigation));
+ if ($this->request->getHeader('If-None-Match') === $etag) {
+ return new DataResponse([], Http::STATUS_NOT_MODIFIED);
+ }
+ $response = new DataResponse($navigation);
+ $response->setEtag($etag);
+ return $response;
}
/**