]> source.dussan.org Git - nextcloud-server.git/commitdiff
Copy over the ETag and LastModified when formatting a Dataresponse 21041/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 19 May 2020 07:39:51 +0000 (09:39 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 19 May 2020 07:39:51 +0000 (09:39 +0200)
This way the ETag checks etc are all working.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/public/AppFramework/Controller.php

index ca35d723242c2e26946c37cb8f713d5652bf561b..db1f95634e039172a0bfdd2aacfd4079836d293c 100644 (file)
@@ -91,6 +91,14 @@ abstract class Controller {
                                                unset($headers['Content-Type']);
                                        }
                                        $response->setHeaders(array_merge($dataHeaders, $headers));
+
+                                       if ($data->getETag() !== null) {
+                                               $response->setETag($data->getETag());
+                                       }
+                                       if ($data->getLastModified() !== null) {
+                                               $response->setLastModified($data->getLastModified());
+                                       }
+
                                        return $response;
                                }
                                return new JSONResponse($data);