Skip to content

Conversation

@backportbot
Copy link

@backportbot backportbot bot commented May 23, 2024

Backport of #44485

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot bot requested review from artonge and nfebe May 23, 2024 14:42
@backportbot backportbot bot added this to the Nextcloud 28.0.6 milestone May 23, 2024
@nfebe nfebe marked this pull request as ready for review May 23, 2024 15:27
@nfebe nfebe requested a review from provokateurin as a code owner May 23, 2024 15:28
@nfebe nfebe enabled auto-merge May 23, 2024 15:28
* @inheritdoc
*/
public function setNoExpirationDate(bool $noExpirationDate) {
$this->noExpirationDate = $noExpirationDate;

Check failure

Code scanning / Psalm

UndefinedThisPropertyAssignment

Instance property OC\Share20\Share::$noExpirationDate is not defined
* @inheritdoc
*/
public function getNoExpirationDate(): bool {
return $this->noExpirationDate;

Check failure

Code scanning / Psalm

UndefinedThisPropertyFetch

Instance property OC\Share20\Share::$noExpirationDate is not defined
* @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

Parameter $expireDate has wrong type 'null|string', should be 'string'
$this->knownUserService = $knownUserService;
$this->shareDisableChecker = $shareDisableChecker;
$this->dateTimeZone = $dateTimeZone;
$this->legacyHooks = new LegacyHooks($this->dispatcher);

Check failure

Code scanning / Psalm

UndefinedThisPropertyFetch

Instance property OC\Share20\Manager::$dispatcher is not defined
// 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

Instance property OC\Share20\Manager::$dateTimeZone is not defined
throw new \InvalidArgumentException('Expiration date is enforced');
}

$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());

Check failure

Code scanning / Psalm

UndefinedThisPropertyFetch

Instance property OC\Share20\Manager::$dateTimeZone is not defined
// 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

Instance property OC\Share20\Manager::$dateTimeZone is not defined
}

if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
$expirationDate = new \DateTime('now', $this->dateTimeZone->getTimeZone());

Check failure

Code scanning / Psalm

UndefinedThisPropertyFetch

Instance property OC\Share20\Manager::$dateTimeZone is not defined
$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

Instance property OC\Share20\Manager::$config is not defined
throw new \InvalidArgumentException('Expiration date is enforced');
}

$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());

Check failure

Code scanning / Psalm

UndefinedThisPropertyFetch

Instance property OC\Share20\Manager::$dateTimeZone is not defined
nfebe added 2 commits May 31, 2024 11:15
If `expireDate` is an empty string and not `null` then the server should not set a default.

Signed-off-by: fenn-cs <[email protected]>
@nfebe nfebe force-pushed the backport/44485/stable28 branch from a81833a to 88b84b8 Compare May 31, 2024 10:16
@nfebe nfebe requested a review from Antreesy May 31, 2024 10:16
- 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]>
@nfebe nfebe force-pushed the backport/44485/stable28 branch from 88b84b8 to 4a583bc Compare May 31, 2024 10:17
* @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.
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LoggerInterface $logger,
private LoggerInterface $logger,

and further?


/** @var bool */
private $hideDownload = false;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private bool $noExpirationDate = false;

@nfebe
Copy link
Contributor

nfebe commented May 31, 2024

Closing in favor of #45604

stable29 had similar backport issues, fixed there and backported via stable29

@nfebe nfebe closed this May 31, 2024
auto-merge was automatically disabled May 31, 2024 13:09

Pull request was closed

@solracsf solracsf deleted the backport/44485/stable28 branch June 1, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants