Browse Source

Improve etag handling

Check if values exist before using them

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/18064/head
Roeland Jago Douma 6 years ago
parent
commit
0568b01267
No known key found for this signature in database GPG Key ID: F941078878347C0C
  1. 26
      lib/private/Files/Storage/Local.php

26
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);
}

Loading…
Cancel
Save