-
Notifications
You must be signed in to change notification settings - Fork 113
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
implement share handling for accepting and listing folder shares #929
Conversation
@C0rby the logic around the base path is wrong. When base is empty means the path is either
so this condition is not triggered. The method Also, with your changes you will stat resources inside a share that don't exist in the home provider, they exist in original storage provider. This assumes that the storage drivers they need to handle resources outside its own storage provider and it not the case. Furthermore, this also assumes that you can create a reference with storage id and paths mixed, also not possible. Please revert the changes in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes requested
No, when the base is empty the path can be a path to a folder. path.Split("/home/MyShare/somefolder/") => dir == "/home/MyShare/somefolder/", base == ""
path.Split("/home/MyShare/somefile") => dir == "/home/MyShare/", base == "somefile" But I'll try to make the owncloud storage driver work without the changes in |
@C0rby, I see, however we should not assume folder paths always end in a slash. |
Can you clarify something for me? // /home/MyShares/photos/
func (s *svc) isShareName(ctx context.Context, p string) bool {
return s.split(ctx, p, 3)
}
// /home/MyShares/photos/Ibiza/beach.png
func (s *svc) isShareChild(ctx context.Context, p string) bool {
return s.split(ctx, p, 4)
} Both of these methods assume that the path contains at least 3 folders before the actual shared file but in the // reference path is the home path + some name
// CreateReferene(cs3://home/MyShares/x)
// that can end up in the storage provider like:
// /eos/user/.shadow/g/gonzalhu/MyShares/x In my understanding this doesn't fit, either |
@C0rby both of those methods assume the path contains at least two folder, In the current design we lock down to the |
@labkode, I know about What I mean is: So now when we call The call to My problem is line 138-148 in log := appctx.GetLogger(ctx)
if s.isSharedFolder(ctx, p) || s.isShareName(ctx, p) {
log.Debug().Msgf("path:%s points to shared folder or share name", p)
err := errtypes.PermissionDenied("gateway: cannot upload to share folder or share name: path=" + p)
log.Err(err).Msg("gateway: error downloading")
return &gateway.InitiateFileDownloadResponse{
Status: status.NewInvalidArg(ctx, "path points to share folder or share name"),
}, nil
}
if s.isShareChild(ctx, p) {
|
@C0rby I understand the problem now. You're trying to mount single file shares and the current checks enforce that only folders are allowed. Can you update your code to make file sharing optional rather than enabled by default? A config option will do. |
67cc424
to
fd56867
Compare
Signed-off-by: David Christofas <dchristofas@owncloud.com>
fd56867
to
30c1c42
Compare
Ok got it. My PR works with folder shares now only. |
Accepting and listing the shares work with this PR. I opened a new issue for downloading the shared files. owncloud/ocis-reva#359 That is not implemented here. |
I implemented share handling functionality in the owncloud storage driver. Most of the code is similar to how eosfs handles shares. There are just some small storage specific differences.
@labkode, I'm not sure if my changes in
internal/grpc/services/gateway/storageprovider.go
will break other storage drivers.I tried to test it with eos but was not able to create share references with it, even without my changes but with the master branch it didn't work.
The reason why I'm using
path.Split
instead ofisSharedFolder
orisShareName
is that the latter assume the path is like/home/MyShare/somefolder/file.txt
. In my understanding that would mean you couldn't share a file from the root folder because such file would have a path like/home/MyShare/file.txt
.Furthermore in line 138 we only care about if the path is a file oder a folder and we can easily distinguish that with
path.Split
.What do you think?
Closes owncloud/ocis-reva#11