-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[stable28] Respect empty expiryDate value in server
#45482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| * @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 <[email protected]>
Signed-off-by: fenn-cs <[email protected]>
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 <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| LoggerInterface $logger, | |
| private LoggerInterface $logger, |
and further?
|
|
||
| /** @var bool */ | ||
| private $hideDownload = false; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.