Skip to content

Commit

Permalink
Leave home prefixing to the gateway (#577)
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo Gonzalez Labrador <[email protected]>
  • Loading branch information
butonic and labkode authored Mar 19, 2020
1 parent 6e1e6dd commit a531571
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package gateway
import (
"context"
"net/url"
"path"
"time"

gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
Expand Down Expand Up @@ -151,16 +150,9 @@ func (s *svc) GetHome(ctx context.Context, req *provider.GetHomeRequest) (*provi
}, nil
}

homeRes.Path = s.prefixProviderPath(res.GetProvider().GetProviderPath(), homeRes.GetPath())

return homeRes, nil
}

// prefixProviderPath prefixes the storage relative home path with the mount point of the storage provider to return a global home path
func (s *svc) prefixProviderPath(providerPath string, storageRelativeExternalPath string) string {
return path.Join(providerPath, storageRelativeExternalPath)
}

func (s *svc) InitiateFileDownload(ctx context.Context, req *provider.InitiateFileDownloadRequest) (*gateway.InitiateFileDownloadResponse, error) {
log := appctx.GetLogger(ctx)
c, err := s.find(ctx, req.Ref)
Expand Down
4 changes: 2 additions & 2 deletions internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ func (s *service) GetPath(ctx context.Context, req *provider.GetPathRequest) (*p
}

func (s *service) GetHome(ctx context.Context, req *provider.GetHomeRequest) (*provider.GetHomeResponse, error) {
home, err := s.storage.GetHome(ctx)
relativeHome, err := s.storage.GetHome(ctx)
if err != nil {
st := status.NewInternal(ctx, err, "error getting home")
return &provider.GetHomeResponse{
Status: st,
}, nil
}

home = path.Join(s.mountPath, home)
home := path.Join(s.mountPath, path.Clean(relativeHome))

res := &provider.GetHomeResponse{
Status: status.NewOK(ctx),
Expand Down

0 comments on commit a531571

Please sign in to comment.