Merge pull request #31632 from Maaxxs/fix-undefined-index-dav

Fixes the undefined index error with the DAV property getlastmodified
This commit is contained in:
Louis 2022-03-29 13:53:15 +02:00 committed by GitHub
commit 7d2cb35988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -587,8 +587,8 @@ class DAV extends Common {
return false;
}
return [
'mtime' => strtotime($response['{DAV:}getlastmodified']),
'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : null,
'size' => (int)($response['{DAV:}getcontentlength'] ?? 0),
];
} catch (\Exception $e) {
$this->convertException($e, $path);
@ -804,9 +804,12 @@ class DAV extends Common {
} else {
return false;
}
} else {
} elseif (isset($response['{DAV:}getlastmodified'])) {
$remoteMtime = strtotime($response['{DAV:}getlastmodified']);
return $remoteMtime > $time;
} else {
// neither `getetag` nor `getlastmodified` is set
return false;
}
} catch (ClientHttpException $e) {
if ($e->getHttpStatus() === 405) {