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 api shared with me response #1346

Merged
merged 1 commit into from
Nov 30, 2020

Conversation

C0rby
Copy link
Contributor

@C0rby C0rby commented Nov 30, 2020

The path of the files shared with me was incorrect. It was missing the share directory.

Fixes: owncloud/product#204

@C0rby C0rby requested a review from labkode as a code owner November 30, 2020 09:48
@C0rby C0rby added the bug Something isn't working label Nov 30, 2020
@C0rby C0rby self-assigned this Nov 30, 2020
@C0rby C0rby requested a review from butonic November 30, 2020 09:48
butonic
butonic previously approved these changes Nov 30, 2020
@@ -813,6 +815,9 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
continue
}
h.addDisplaynames(r.Context(), gwc, data)
// Needed because received shares can be jailed in a folder in the users home
data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Path))
data.Path = path.Join(h.sharePrefix, path.Base(info.Path))
Copy link
Contributor

@butonic butonic Nov 30, 2020

Choose a reason for hiding this comment

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

hm, the info.Path should already contain the share prefix ... ah wait, the request firts queries the share manager, which only knows file ids, and then sends a stat request to the storage provider to fill in the file details.

@labkode Another reason why I think we need a service that keeps track of mountpoints. IMO that is the storage registry. It should know the file reference and the mount point. then it can cache the etag for every root, especially the shares. We can then change this hardcoded SharePrefix to an arbitrary location in the users home and calculate the etag based on the information that is cached in the storage registry.

For now this is LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, the info.Path should already contain the share prefix ... ah wait, the request firts queries the share manager, which only knows file ids, and then sends a stat request to the storage provider to fill in the file details.

Yes, exactly that was the problem here. 🙈

@butonic
Copy link
Contributor

butonic commented Nov 30, 2020

@C0rby the tests seem to indicate that only accepted shares get the prefix.

@phil-davis
Copy link
Contributor

@C0rby the tests seem to indicate that only accepted shares get the prefix.

Yes, in oC10 when a user asks for the shares that are waiting to be accepted (pending) shared_with_me=true&state=pending then the response has the folder or file name that the sharer is sharing. The response does not "pre-calculate" that the share will end up in the share receiver's /Shares folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shared with me row path leading to wrong target
4 participants