diff --git a/lib/Model/ShareWrapper.php b/lib/Model/ShareWrapper.php index af13b6c06..9d0a04ea9 100644 --- a/lib/Model/ShareWrapper.php +++ b/lib/Model/ShareWrapper.php @@ -31,6 +31,7 @@ use OCP\Share\Exceptions\IllegalIDChangeException; use OCP\Share\IAttributes; use OCP\Share\IShare; +use Psr\Log\LoggerInterface; /** * Class ShareWrapper @@ -392,6 +393,9 @@ public function getShare( $share->setProviderId($this->getProviderId()); $share->setStatus($this->getStatus()); $share->setToken($this->getToken()); + if ($this->getExpirationDate() !== null) { + $share->setExpirationDate($this->getExpirationDate()); + } $share->setHideDownload($this->getHideDownload()); $share->setAttributes($this->getAttributes()); $share->setNote($this->getShareNote()); @@ -557,6 +561,15 @@ public function importFromDatabase(array $data, string $prefix = ''): IQueryRow ->setShareTime($shareTime) ->setShareNote($this->get($prefix . 'note', $data)); + try { + $expirationDate = $this->get('expiration', $data); + if ($expirationDate !== '') { + $this->setExpirationDate(new DateTime($expirationDate)); + } + } catch (\Exception $e) { + Server::get(LoggerInterface::class)->warning('could not parse expiration date', ['exception' => $e]); + } + $this->importAttributesFromDatabase($this->get('attributes', $data)); // if (($password = $this->get('personal_password', $data, '')) !== '') {