From 2ca5c69e15df861f83b9bbd2610364c0bef1ad9d Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 2 Sep 2025 15:14:31 -0100 Subject: [PATCH] fix(share): extract expiration from cached data Signed-off-by: Maxence Lange --- lib/Model/ShareWrapper.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Model/ShareWrapper.php b/lib/Model/ShareWrapper.php index c4369ac8f..40d7ceb4f 100644 --- a/lib/Model/ShareWrapper.php +++ b/lib/Model/ShareWrapper.php @@ -512,9 +512,9 @@ public function import(array $data): IDeserializable { $this->importAttributesFromDatabase($this->get('attributes', $data)); try { - $expirationDate = $this->get('expiration', $data); - if ($expirationDate !== '') { - $this->setExpirationDate(new DateTime($expirationDate)); + $expirationDate = $this->getInt('expiration', $data); + if ($expirationDate > 0) { + $this->setExpirationDate((new DateTime())->setTimestamp($expirationDate)); } } catch (\Exception $e) { } @@ -578,7 +578,7 @@ public function importFromDatabase(array $data, string $prefix = ''): IQueryRow ->setShareNote($this->get($prefix . 'note', $data)); try { - $expirationDate = $this->get('expiration', $data); + $expirationDate = $this->get($prefix . 'expiration', $data); if ($expirationDate !== '') { $this->setExpirationDate(new DateTime($expirationDate)); } @@ -643,6 +643,7 @@ public function jsonSerialize(): array { 'itemTarget' => $this->getItemTarget(), 'fileSource' => $this->getFileSource(), 'fileTarget' => $this->getFileTarget(), + 'expiration' => $this->getExpirationDate()?->getTimestamp(), 'status' => $this->getStatus(), 'shareTime' => $this->getShareTime()->getTimestamp(), 'note' => $this->getShareNote(),