Skip to content

Commit 48dc40e

Browse files
committed
fix(Sharing): Ensure share object has null expiration when required
If the incoming `expireDate` is an empty string, we want to ensure the share object itself gets valid date for for empty string which is `null` before attempting to save. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
1 parent 5e299a1 commit 48dc40e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/private/Share20/Manager.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ protected function validateExpirationDateInternal(IShare $share) {
451451
throw new GenericShareException($message, $message, 404);
452452
}
453453
}
454+
} else {
455+
$expirationDate = null;
454456
}
455457

456458
$accepted = true;
@@ -532,6 +534,8 @@ protected function validateExpirationDateLink(IShare $share) {
532534
throw new GenericShareException($message, $message, 404);
533535
}
534536
}
537+
} else {
538+
$expirationDate = null;
535539
}
536540

537541
$accepted = true;
@@ -1020,15 +1024,15 @@ public function updateShare(IShare $share) {
10201024

10211025
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
10221026
//Verify the expiration date
1023-
$this->validateExpirationDateInternal($share);
1027+
$share = $this->validateExpirationDateInternal($share);
10241028
$expirationDateUpdated = true;
10251029
}
10261030
} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
10271031
$this->groupCreateChecks($share);
10281032

10291033
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
10301034
//Verify the expiration date
1031-
$this->validateExpirationDateInternal($share);
1035+
$share = $this->validateExpirationDateInternal($share);
10321036
$expirationDateUpdated = true;
10331037
}
10341038
} elseif ($share->getShareType() === IShare::TYPE_LINK
@@ -1064,13 +1068,13 @@ public function updateShare(IShare $share) {
10641068

10651069
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
10661070
// Verify the expiration date
1067-
$this->validateExpirationDateLink($share);
1071+
$share = $this->validateExpirationDateLink($share);
10681072
$expirationDateUpdated = true;
10691073
}
10701074
} elseif ($share->getShareType() === IShare::TYPE_REMOTE || $share->getShareType() === IShare::TYPE_REMOTE_GROUP) {
10711075
if ($share->getExpirationDate() != $originalShare->getExpirationDate()) {
10721076
//Verify the expiration date
1073-
$this->validateExpirationDateInternal($share);
1077+
$share = $this->validateExpirationDateInternal($share);
10741078
$expirationDateUpdated = true;
10751079
}
10761080
}

0 commit comments

Comments
 (0)