Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading