Skip to content

Commit

Permalink
Merge pull request #47837 from nextcloud/fix/files/dav-etag
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Sep 9, 2024
2 parents 1fa674d + 70fa51f commit 0f73219
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
8 changes: 1 addition & 7 deletions lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0f73219

Please sign in to comment.