Skip to content

Commit

Permalink
Update user share must use correct expiration validation
Browse files Browse the repository at this point in the history
Updating a user or group share now uses the correct method for the
validation of the expiration date. Instead of using the one from links
it uses the one for internal shares.

To avoid future confusion, the method "validateExpirationDate" has been
renamed to "validateExpirationDateLink".

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Mar 19, 2021
1 parent 8670ef7 commit ecaa026
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
10 changes: 5 additions & 5 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ protected function validateExpirationDateInternal(\OCP\Share\IShare $share) {
* @throws \InvalidArgumentException
* @throws \Exception
*/
protected function validateExpirationDate(\OCP\Share\IShare $share) {
protected function validateExpirationDateLink(\OCP\Share\IShare $share) {
$expirationDate = $share->getExpirationDate();

if ($expirationDate !== null) {
Expand Down Expand Up @@ -761,7 +761,7 @@ public function createShare(\OCP\Share\IShare $share) {
);

//Verify the expiration date
$share = $this->validateExpirationDate($share);
$share = $this->validateExpirationDateLink($share);

//Verify the password
$this->verifyPassword($share->getPassword());
Expand Down Expand Up @@ -969,15 +969,15 @@ public function updateShare(\OCP\Share\IShare $share) {

if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
//Verify the expiration date
$this->validateExpirationDate($share);
$this->validateExpirationDateInternal($share);
$expirationDateUpdated = true;
}
} elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
$this->groupCreateChecks($share);

if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
//Verify the expiration date
$this->validateExpirationDate($share);
$this->validateExpirationDateInternal($share);
$expirationDateUpdated = true;
}
} elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
Expand All @@ -993,7 +993,7 @@ public function updateShare(\OCP\Share\IShare $share) {

if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
//Verify the expiration date
$this->validateExpirationDate($share);
$this->validateExpirationDateLink($share);
$expirationDateUpdated = true;
}
} elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
Expand Down
Loading

0 comments on commit ecaa026

Please sign in to comment.