[stable28] Respect empty expiryDate value in server#45482
[stable28] Respect empty expiryDate value in server#45482backportbot[bot] wants to merge 3 commits intostable28from
expiryDate value in server#45482Conversation
| * @inheritdoc | ||
| */ | ||
| public function setNoExpirationDate(bool $noExpirationDate) { | ||
| $this->noExpirationDate = $noExpirationDate; |
Check failure
Code scanning / Psalm
UndefinedThisPropertyAssignment
| * @inheritdoc | ||
| */ | ||
| public function getNoExpirationDate(): bool { | ||
| return $this->noExpirationDate; |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| * @param string $password Password for the share | ||
| * @param string|null $sendPasswordByTalk Send the password for the share over Talk | ||
| * @param string $expireDate Expiry date of the share using user timezone at 00:00. It means date in UTC timezone will be used. | ||
| * @param ?string $expireDate The expiry date of the share in the user's timezone (UTC) at 00:00. |
Check failure
Code scanning / Psalm
MismatchingDocblockParamType
| $this->knownUserService = $knownUserService; | ||
| $this->shareDisableChecker = $shareDisableChecker; | ||
| $this->dateTimeZone = $dateTimeZone; | ||
| $this->legacyHooks = new LegacyHooks($this->dispatcher); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| // Then skip expiration date validation as null is accepted | ||
| if(!($share->getNoExpirationDate() && !$isEnforced)) { | ||
| if ($expirationDate != null) { | ||
| $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| throw new \InvalidArgumentException('Expiration date is enforced'); | ||
| } | ||
|
|
||
| $date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| // Then skip expiration date validation as null is accepted | ||
| if(!($share->getNoExpirationDate() && !$isEnforced)) { | ||
| if ($expirationDate !== null) { | ||
| $expirationDate->setTimezone($this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| } | ||
|
|
||
| if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { | ||
| $expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| $expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); | ||
| $expirationDate->setTime(0, 0, 0); | ||
|
|
||
| $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', (string)$this->shareApiLinkDefaultExpireDays()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
| throw new \InvalidArgumentException('Expiration date is enforced'); | ||
| } | ||
|
|
||
| $date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch
bcd8482 to
a81833a
Compare
If `expireDate` is an empty string and not `null` then the server should not set a default. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
a81833a to
88b84b8
Compare
- Verify that explicitly sending empty `expireDate` param to server overwrite default and sets not expiry date, if non is enforced. - Update tests to avoid converting empty string to date. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
88b84b8 to
4a583bc
Compare
| * @param string $password Password for the share | ||
| * @param string|null $sendPasswordByTalk Send the password for the share over Talk | ||
| * @param string $expireDate Expiry date of the share using user timezone at 00:00. It means date in UTC timezone will be used. | ||
| * @param ?string $expireDate The expiry date of the share in the user's timezone (UTC) at 00:00. |
There was a problem hiding this comment.
L612 missing?
?string $expireDate = null,And L793?
if ($expireDate !== null) {
if ($expireDate !== '') {| private LegacyHooks $legacyHooks; | ||
|
|
||
| public function __construct( | ||
| LoggerInterface $logger, |
There was a problem hiding this comment.
| LoggerInterface $logger, | |
| private LoggerInterface $logger, |
and further?
|
|
||
| /** @var bool */ | ||
| private $hideDownload = false; | ||
|
|
There was a problem hiding this comment.
| private bool $noExpirationDate = false; |
|
Closing in favor of #45604 stable29 had similar backport issues, fixed there and backported via stable29 |
Backport of #44485
Warning, This backport's changes differ from the original and might be incomplete⚠️
Todo
Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.