From 2aff11c80bbc7fb0524c52d17824d68bda43aac5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Sat, 29 Aug 2015 13:31:18 +0200 Subject: Actually validate the expire date on share * Added more intergration tests --- lib/private/share/share.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/private/share/share.php b/lib/private/share/share.php index 9aea4677b5b..7b052483ac3 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -649,6 +649,21 @@ class Share extends Constants { $permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE; } + //Validate expirationDate + if ($expirationDate !== null) { + try { + /* + * Reuse the validateExpireDate. + * We have to pass time() since the second arg is the time + * the file was shared, since it is not shared yet we just use + * the current time. + */ + $expirationDate = self::validateExpireDate($expirationDate->format('Y-m-d'), time(), $itemType, $itemSource); + } catch (\Exception $e) { + throw new \OC\HintException($e->getMessage(), $e->getMessage(), 404); + } + } + // Verify share type and sharing conditions are met if ($shareType === self::SHARE_TYPE_USER) { if ($shareWith == $uidOwner) { -- cgit v1.2.3