diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-19 09:39:51 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-19 09:39:51 +0200 |
commit | c92c378a9c6406265c60c08462b0378dbeaad978 (patch) | |
tree | 4d31c7be29996e4e2e1b6b6dadf40bd9eea8af70 /lib/public/AppFramework | |
parent | 187eedf443fcfd8af6b42988f200c055bfeda57a (diff) | |
download | nextcloud-server-c92c378a9c6406265c60c08462b0378dbeaad978.tar.gz nextcloud-server-c92c378a9c6406265c60c08462b0378dbeaad978.zip |
Copy over the ETag and LastModified when formatting a Dataresponse
This way the ETag checks etc are all working.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public/AppFramework')
-rw-r--r-- | lib/public/AppFramework/Controller.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index ca35d723242..db1f95634e0 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -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); |