From ee888875bb01031c6f21e48832313641ee6d726e Mon Sep 17 00:00:00 2001 From: Max Kunzelmann Date: Sun, 20 Mar 2022 00:38:07 +0100 Subject: Fixes the undefined index error with the DAV property getlastmodified Signed-off-by: Max Kunzelmann --- lib/private/Files/Storage/DAV.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index b4a85755b20..e4cea9dd60b 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -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) { -- cgit v1.2.3 From e0a5fe649a73edc3769af1b9af1d2938fd327cc2 Mon Sep 17 00:00:00 2001 From: Max Kunzelmann Date: Sun, 20 Mar 2022 11:07:36 +0100 Subject: Fix typo. Signed-off-by: Max Kunzelmann --- lib/private/Files/Storage/DAV.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index e4cea9dd60b..bd818bf33a2 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -587,7 +587,7 @@ class DAV extends Common { return false; } return [ - 'mtime' => isset($response['{DAV:getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : false, + 'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : false, 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, ]; } catch (\Exception $e) { -- cgit v1.2.3 From 3a135f0c5f02dc7dbcd8dc6879fd9dc4260f72b0 Mon Sep 17 00:00:00 2001 From: Max Kunzelmann Date: Wed, 23 Mar 2022 14:58:02 +0100 Subject: Set `mtime` to null instead of false if `getlastmodified` does not exist. Signed-off-by: Max Kunzelmann --- lib/private/Files/Storage/DAV.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index bd818bf33a2..568262d9817 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -587,7 +587,7 @@ class DAV extends Common { return false; } return [ - 'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : false, + 'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : null, 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, ]; } catch (\Exception $e) { -- cgit v1.2.3 From 2952c7d01f9cbb7c22c532a895bb7b5ec3d528ea Mon Sep 17 00:00:00 2001 From: Max Kunzelmann Date: Mon, 28 Mar 2022 22:22:36 +0200 Subject: Use the null coalescing operator to set the value of `size`. Signed-off-by: Max Kunzelmann --- lib/private/Files/Storage/DAV.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 568262d9817..ee874d97b55 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -588,7 +588,7 @@ class DAV extends Common { } return [ 'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : null, - 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, + 'size' => (int)($response['{DAV:}getcontentlength'] ?? 0), ]; } catch (\Exception $e) { $this->convertException($e, $path); -- cgit v1.2.3