mirror of
https://github.com/nextcloud/server.git
synced 2026-02-28 12:30:40 -05:00
fix(share): Set expiration time to end of day (23:59:59)
Shares now expire at the end of the selected day instead of the beginning, allowing access throughout the entire expiration day. Also return actual stored time in API response instead of hardcoded 00:00:00 to prevent timezone-related display issues in the UI. Signed-off-by: nfebe <fenn25.fn@gmail.com>
This commit is contained in:
parent
360de52879
commit
b601b03084
2 changed files with 7 additions and 7 deletions
|
|
@ -236,7 +236,7 @@ class ShareAPIController extends OCSController {
|
|||
$expiration = $share->getExpirationDate();
|
||||
if ($expiration !== null) {
|
||||
$expiration->setTimezone($this->dateTimeZone->getTimeZone());
|
||||
$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
|
||||
$result['expiration'] = $expiration->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
if ($share->getShareType() === IShare::TYPE_USER) {
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ class Manager implements IManager {
|
|||
if (!$share->getNoExpirationDate() || $isEnforced) {
|
||||
if ($expirationDate !== null) {
|
||||
$expirationDate->setTimezone($this->dateTimeZone->getTimeZone());
|
||||
$expirationDate->setTime(0, 0, 0);
|
||||
$expirationDate->setTime(23, 59, 59);
|
||||
|
||||
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());
|
||||
$date->setTime(0, 0, 0);
|
||||
|
|
@ -313,7 +313,7 @@ class Manager implements IManager {
|
|||
|
||||
if ($fullId === null && $expirationDate === null && $defaultExpireDate) {
|
||||
$expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone());
|
||||
$expirationDate->setTime(0, 0, 0);
|
||||
$expirationDate->setTime(23, 59, 59);
|
||||
$days = (int)$this->config->getAppValue('core', $configProp, (string)$defaultExpireDays);
|
||||
if ($days > $defaultExpireDays) {
|
||||
$days = $defaultExpireDays;
|
||||
|
|
@ -328,7 +328,7 @@ class Manager implements IManager {
|
|||
}
|
||||
|
||||
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());
|
||||
$date->setTime(0, 0, 0);
|
||||
$date->setTime(23, 59, 59);
|
||||
$date->add(new \DateInterval('P' . $defaultExpireDays . 'D'));
|
||||
if ($date < $expirationDate) {
|
||||
throw new GenericShareException($this->l->n('Cannot set expiration date more than %n day in the future', 'Cannot set expiration date more than %n days in the future', $defaultExpireDays), code: 404);
|
||||
|
|
@ -372,7 +372,7 @@ class Manager implements IManager {
|
|||
if (!($share->getNoExpirationDate() && !$isEnforced)) {
|
||||
if ($expirationDate !== null) {
|
||||
$expirationDate->setTimezone($this->dateTimeZone->getTimeZone());
|
||||
$expirationDate->setTime(0, 0, 0);
|
||||
$expirationDate->setTime(23, 59, 59);
|
||||
|
||||
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());
|
||||
$date->setTime(0, 0, 0);
|
||||
|
|
@ -391,7 +391,7 @@ class Manager implements IManager {
|
|||
|
||||
if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
|
||||
$expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone());
|
||||
$expirationDate->setTime(0, 0, 0);
|
||||
$expirationDate->setTime(23, 59, 59);
|
||||
|
||||
$days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', (string)$this->shareApiLinkDefaultExpireDays());
|
||||
if ($days > $this->shareApiLinkDefaultExpireDays()) {
|
||||
|
|
@ -407,7 +407,7 @@ class Manager implements IManager {
|
|||
}
|
||||
|
||||
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());
|
||||
$date->setTime(0, 0, 0);
|
||||
$date->setTime(23, 59, 59);
|
||||
$date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D'));
|
||||
if ($date < $expirationDate) {
|
||||
throw new GenericShareException(
|
||||
|
|
|
|||
Loading…
Reference in a new issue