aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-23 14:14:41 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 13:34:42 +0100
commit0568b012672d650c6b5a49e72c4028dde5463c60 (patch)
tree2c745f0cc7cb0576384eb0510095d46f3d91d98f /lib/private
parentec14d95292c42ce84320cadcd1b6cf8f5d543131 (diff)
downloadnextcloud-server-0568b012672d650c6b5a49e72c4028dde5463c60.tar.gz
nextcloud-server-0568b012672d650c6b5a49e72c4028dde5463c60.zip
Improve etag handling
Check if values exist before using them Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Storage/Local.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index e9a9e8e9885..aade0cdaf25 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -424,12 +424,26 @@ class Local extends \OC\Files\Storage\Common {
public function getETag($path) {
if ($this->is_file($path)) {
$stat = $this->stat($path);
- return md5(
- $stat['mtime'] .
- $stat['ino'] .
- $stat['dev'] .
- $stat['size']
- );
+
+ if ($stat === false) {
+ return md5('');
+ }
+
+ $toHash = '';
+ if (isset($stat['mtime'])) {
+ $toHash .= $stat['mtime'];
+ }
+ if (isset($stat['ino'])) {
+ $toHash .= $stat['ino'];
+ }
+ if (isset($stat['dev'])) {
+ $toHash .= $stat['dev'];
+ }
+ if (isset($stat['size'])) {
+ $toHash .= $stat['size'];
+ }
+
+ return md5($toHash);
} else {
return parent::getETag($path);
}