Fixes the undefined index error with the DAV property getlastmodified

Signed-off-by: Max Kunzelmann <maxdev@posteo.de>
This commit is contained in:
Max Kunzelmann 2022-03-20 00:38:07 +01:00
parent a1c148a7e7
commit ee888875bb

View file

@ -587,7 +587,7 @@ class DAV extends Common {
return false;
}
return [
'mtime' => strtotime($response['{DAV:}getlastmodified']),
'mtime' => isset($response['{DAV:getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : false,
'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
];
} catch (\Exception $e) {
@ -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) {