Skip to content

Only save federated share after remote server is notified - #25262

Merged
PVince81 merged 3 commits into
masterfrom
fed-sharing-error
Jul 1, 2016
Merged

PVince81 merged 3 commits into
masterfrom
fed-sharing-error

Conversation

@icewind1991

Copy link
Copy Markdown
Contributor

If we fail to notify the remote share the entry in the share table is useless but the sharee will still think the file is shared.

Also improves error handling a bit by showing an error message if a non-json result is returned from the share call.

cc @owncloud/sharing @PVince81

@icewind1991 icewind1991 added this to the 9.1-current milestone Jun 24, 2016
@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @schiessle, @PVince81 and @blizzz to be potential reviewers

@PVince81

Copy link
Copy Markdown
Contributor

👍 makes sense

@jvillafanez @rullzer

@jvillafanez

Copy link
Copy Markdown
Member

👍

@PVince81

Copy link
Copy Markdown
Contributor

@icewind1991 please adjust the tests

1) OCA\FederatedFileSharing\Tests\FederatedShareProviderTest::testCreate
10:23:39 Undefined variable: shareId
10:23:39 
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:220
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:194
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/tests/FederatedShareProviderTest.php:151
10:23:39 
10:23:39 2) OCA\FederatedFileSharing\Tests\FederatedShareProviderTest::testCreateAlreadyShared
10:23:39 Undefined variable: shareId
10:23:39 
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:220
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:194
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/tests/FederatedShareProviderTest.php:323
10:23:39 
10:23:39 3) OCA\FederatedFileSharing\Tests\FederatedShareProviderTest::testUpdate with data set #0 ('sharedBy', 'shareOwner')
10:23:39 Undefined variable: shareId
10:23:39 
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:220
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:194
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/tests/FederatedShareProviderTest.php:394
10:23:39 
10:23:39 4) OCA\FederatedFileSharing\Tests\FederatedShareProviderTest::testUpdate with data set #1 ('shareOwner', 'shareOwner')
10:23:39 Undefined variable: shareId
10:23:39 
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:220
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:194
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/tests/FederatedShareProviderTest.php:394
10:23:39 
10:23:39 5) OCA\FederatedFileSharing\Tests\FederatedShareProviderTest::testGetSharedBy
10:23:39 Undefined variable: shareId
10:23:39 
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:220
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:194
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/tests/FederatedShareProviderTest.php:435
10:23:39 
10:23:39 6) OCA\FederatedFileSharing\Tests\FederatedShareProviderTest::testGetSharedByWithNode
10:23:39 Undefined variable: shareId
10:23:39 
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:220
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/lib/FederatedShareProvider.php:194
10:23:39 /ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/federatedfilesharing/tests/FederatedShareProviderTest.php:470
10:23:39 

@icewind1991

Copy link
Copy Markdown
Contributor Author

reworked it a bit, should be fine now

if ($send === false) {
$message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.',
[$share->getNode()->getName(), $share->getSharedWith()]);
throw new \Exception($message_t);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are several things here that look weird to me:

  • Throwing a plain exception doesn't look good. Is there any other more specific exception that could be used? Is it worthy to create a new custom exception for this?
  • Catching all exceptions (the catch block) sounds very heavy. Do we really need to catch all, even though we rethrow the exception? Do we want to remove the share for any exception we catch? It will likely be fine (I don't see any reason it would fail) but, as I've said, heavy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Throwing a plain exception doesn't look good.

The exception throw is unchanged in this pr, I don't think we have a better one existing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do we really need to catch all, even though we rethrow the exception?

imo it's safest here to catch everything

@jvillafanez

Copy link
Copy Markdown
Member

That's all my comments for the new changes.

@jvillafanez

Copy link
Copy Markdown
Member

👍 again for the changes

@PVince81 PVince81 modified the milestones: 9.2, 9.1 Jul 1, 2016
@PVince81

PVince81 commented Jul 1, 2016

Copy link
Copy Markdown
Contributor

Looks good, fed sharing still works 👍

@PVince81
PVince81 merged commit 027715f into master Jul 1, 2016
@PVince81
PVince81 deleted the fed-sharing-error branch July 1, 2016 14:20
PVince81 pushed a commit that referenced this pull request Jul 8, 2016
This reverts commit 027715f, reversing
changes made to e42ce62.
DeepDiver1975 pushed a commit that referenced this pull request Jul 8, 2016
* Revert "Merge pull request #25240 from owncloud/remove-svg"

This reverts commit 8b8d2b6, reversing
changes made to a35747b.

* Revert "Merge pull request #25253 from owncloud/users-fixotherquotadropdown"

This reverts commit a35747b, reversing
changes made to a573b68.

* Revert "Merge pull request #25314 from owncloud/files_external-backends-config"

This reverts commit a573b68, reversing
changes made to 8147eef.

* Revert "Add all properties while creating a subscription (#25318)"

This reverts commit aaf4c30.

* Revert "Merge pull request #25276 from owncloud/delete-own-session-token"

This reverts commit e42ce62, reversing
changes made to aaf4c30.

* Revert "Merge pull request #25262 from owncloud/fed-sharing-error"

This reverts commit 027715f, reversing
changes made to e42ce62.
@lock

lock Bot commented Aug 5, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants