From 70fa51f042014cfaf80d489a838eafc4b08192b3 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 9 Sep 2024 10:11:07 +0200 Subject: [PATCH] fix(files): Never return a null ETag in DAV Signed-off-by: provokateurin --- lib/private/Files/Storage/Common.php | 2 +- lib/private/Files/Storage/DAV.php | 3 +-- lib/private/Files/Storage/Local.php | 8 +------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 9541ba7c74624..cefba66683bce 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -391,7 +391,7 @@ public function getOwner($path) { * get the ETag for a file or folder * * @param string $path - * @return string + * @return string|false */ public function getETag($path) { return uniqid(); diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index ac9b7a7285593..4c017082ceafd 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -721,10 +721,9 @@ public function getPermissions($path) { return $stat ? $stat['permissions'] : 0; } - /** {@inheritdoc} */ public function getETag($path) { $meta = $this->getMetaData($path); - return $meta ? $meta['etag'] : null; + return $meta ? $meta['etag'] : false; } /** diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index a65d60bf278dd..bb07ce3ab29fa 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -513,17 +513,11 @@ public function isLocal() { return true; } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string - */ public function getETag($path) { return $this->calculateEtag($path, $this->stat($path)); } - private function calculateEtag(string $path, array $stat): string { + private function calculateEtag(string $path, array $stat): string|false { if ($stat['mode'] & 0x4000 && !($stat['mode'] & 0x8000)) { // is_dir & not socket return parent::getETag($path); } else {