aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-09-09 10:11:07 +0200
committerprovokateurin <kate@provokateurin.de>2024-09-09 10:30:33 +0200
commit70fa51f042014cfaf80d489a838eafc4b08192b3 (patch)
tree14c8f8f14036d484e1db76911c0cd4df230307b4
parenta2cfcf3ca71cf748d8507f8ac490df89405b2a68 (diff)
downloadnextcloud-server-70fa51f042014cfaf80d489a838eafc4b08192b3.tar.gz
nextcloud-server-70fa51f042014cfaf80d489a838eafc4b08192b3.zip
fix(files): Never return a null ETag in DAV
Signed-off-by: provokateurin <kate@provokateurin.de>
-rw-r--r--lib/private/Files/Storage/Common.php2
-rw-r--r--lib/private/Files/Storage/DAV.php3
-rw-r--r--lib/private/Files/Storage/Local.php8
3 files changed, 3 insertions, 10 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 9541ba7c746..cefba66683b 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -391,7 +391,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
* 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 ac9b7a72855..4c017082cea 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -721,10 +721,9 @@ class DAV extends Common {
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 a65d60bf278..bb07ce3ab29 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -513,17 +513,11 @@ class Local extends \OC\Files\Storage\Common {
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 {