Skip to content
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

Fix OCS Share API path response #25003

Merged
merged 3 commits into from
Jun 10, 2016
Merged

Fix OCS Share API path response #25003

merged 3 commits into from
Jun 10, 2016

Conversation

rullzer
Copy link
Contributor

@rullzer rullzer commented Jun 7, 2016

Fixes #24997

There are only 3 possible types of users that can request a share via the OCS Share API:

  • owner
  • inituator
  • recipient

Else they won't find the share.
This makes sure we get the share for the current user. So that the path is always something meaningfull for that user.

CC: @nickvergessen @PVince81 @icewind1991 @scriptPilot

$node = $share->getNode();
$result['path'] = $this->rootFolder->getUserFolder($localUser)->getRelativePath($node->getPath());
$userFolder = $this->rootFolder->getUserFolder($this->currentUser->getUID());
$node = $userFolder->getById($share->getNodeId())[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

check for non empty result from getById ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right... in case of messed up shares... yeah lets check that...

A share can only be requested by 3 'types' of people

* owner
* initiator
* recipient

So we have to get the path as the current user. Since that is the only
path that has any meaning to the user.
@rullzer
Copy link
Contributor Author

rullzer commented Jun 7, 2016

This basically obsoletes the 'target' in the OCS SHare API response.

@PVince81
Copy link
Contributor

PVince81 commented Jun 8, 2016

Tested, works 👍

@rullzer also observed on 9.0, please backport after review

CC @dragotin @DeepDiver1975

@PVince81
Copy link
Contributor

Need seconds reviewer @ChristophWurst @nickvergessen @DeepDiver1975 @owncloud/sharing

@icewind1991
Copy link
Contributor

👍 looks good

@PVince81 PVince81 merged commit 14fde66 into master Jun 10, 2016
@PVince81 PVince81 deleted the fix_ocs_path_response branch June 10, 2016 14:49
@PVince81
Copy link
Contributor

@rullzer please backport to 9.0

@rullzer
Copy link
Contributor Author

rullzer commented Jun 10, 2016

Backport in #25067

@lock
Copy link

lock bot commented Aug 5, 2019

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.

Shared from you view shows wrong folder names
5 participants