-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[stable28] Respect empty expiryDate
value in server
#45482
Conversation
* @inheritdoc | ||
*/ | ||
public function setNoExpirationDate(bool $noExpirationDate) { | ||
$this->noExpirationDate = $noExpirationDate; |
Check failure
Code scanning / Psalm
UndefinedThisPropertyAssignment Error
* @inheritdoc | ||
*/ | ||
public function getNoExpirationDate(): bool { | ||
return $this->noExpirationDate; |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch Error
@@ -586,7 +586,8 @@ | |||
* @param string $publicUpload If public uploading is allowed | |||
* @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 Error
$this->knownUserService = $knownUserService; | ||
$this->shareDisableChecker = $shareDisableChecker; | ||
$this->dateTimeZone = $dateTimeZone; | ||
$this->legacyHooks = new LegacyHooks($this->dispatcher); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch Error
// 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 Error
throw new \InvalidArgumentException('Expiration date is enforced'); | ||
} | ||
|
||
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch Error
// 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 Error
} | ||
|
||
if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { | ||
$expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch Error
$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 Error
throw new \InvalidArgumentException('Expiration date is enforced'); | ||
} | ||
|
||
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone()); |
Check failure
Code scanning / Psalm
UndefinedThisPropertyFetch Error
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
@@ -586,7 +586,8 @@ public function deleteShare(string $id): DataResponse { | |||
* @param string $publicUpload If public uploading is allowed | |||
* @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 IDateTimeZone $dateTimeZone; | ||
|
||
private IL10N|null $l; | ||
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?
@@ -99,7 +99,6 @@ class Share implements IShare { | |||
|
|||
/** @var ICacheEntry|null */ | |||
private $nodeCacheEntry; | |||
|
|||
/** @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.