Skip to content

[stable30] Fix federated reshares#58992

Open
provokateurin wants to merge 2 commits intostable30from
backport/58689/stable30
Open

[stable30] Fix federated reshares#58992
provokateurin wants to merge 2 commits intostable30from
backport/58689/stable30

Conversation

@provokateurin
Copy link
Member

Manual backport of #58689

Signed-off-by: provokateurin <kate@provokateurin.de>
…r might on another server

Signed-off-by: provokateurin <kate@provokateurin.de>
@provokateurin provokateurin added bug 3. to review Waiting for reviews labels Mar 17, 2026
@provokateurin provokateurin changed the title [stable30] fix(federatedfilesharing): Do not set the share id for an existing share [stable30] Fix federated reshares Mar 17, 2026
if ($send) {
$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate);
[$token, $remoteId] = $this->notifications->requestReShare(

Check failure

Code scanning / Psalm

TooManyArguments Error

Too many arguments for method OCA\FederatedFileSharing\Notifications::requestreshare - saw 8
Copy link
Contributor

Choose a reason for hiding this comment

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

Some changes may be missing, the shareType param is not in requestReShare

$this->storeRemoteId($shareId, $remoteId);
} else {
$this->removeShareFromTable($share);
$this->removeShareFromTable($shareId);

Check failure

Code scanning / Psalm

InvalidScalarArgument Error

Argument 1 of OCA\FederatedFileSharing\FederatedShareProvider::removeShareFromTable expects string, but int provided

if ($failure) {
$this->removeShareFromTableById($shareId);
$this->removeShareFromTable($shareId);

Check failure

Code scanning / Psalm

InvalidScalarArgument Error

Argument 1 of OCA\FederatedFileSharing\FederatedShareProvider::removeShareFromTable expects string, but int provided
}
if ($send) {
$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate);

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 9 of OCA\FederatedFileSharing\FederatedShareProvider::addShareToDB cannot be null, possibly null value provided
Copy link
Contributor

Choose a reason for hiding this comment

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

The expiration column is nullable so null is acceptable, provided that createNamedParameter handles this correctly.

if ($send) {
$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate);
[$token, $remoteId] = $this->notifications->requestReShare(

Check notice

Code scanning / Psalm

PossiblyInvalidArrayAccess Note

Cannot access array value on non-array variable of type false
if ($send) {
$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate);
[$token, $remoteId] = $this->notifications->requestReShare(

Check notice

Code scanning / Psalm

PossiblyInvalidArrayAccess Note

Cannot access array value on non-array variable of type false
[$token, $remoteId] = $this->notifications->requestReShare(
$remoteShare['share_token'],
$remoteShare['remote_id'],
$shareId,

Check notice

Code scanning / Psalm

InvalidArgument Note

Argument 3 of OCA\FederatedFileSharing\Notifications::requestReShare expects string, but int provided
@salmart-dev
Copy link
Contributor

Same issue here with the share ID being int instead of string.

}
if ($send) {
$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate);
Copy link
Contributor

Choose a reason for hiding this comment

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

The expiration column is nullable so null is acceptable, provided that createNamedParameter handles this correctly.

if ($send) {
$ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']);
$shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType, $expirationDate);
[$token, $remoteId] = $this->notifications->requestReShare(
Copy link
Contributor

Choose a reason for hiding this comment

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

Some changes may be missing, the shareType param is not in requestReShare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants