fix(files): Never return a null ETag in DAV

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2024-09-09 10:11:07 +02:00
parent a2cfcf3ca7
commit 70fa51f042
No known key found for this signature in database
3 changed files with 3 additions and 10 deletions

View file

@ -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();

View file

@ -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;
}
/**

View file

@ -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 {