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

Local storage provider: Fixed resolution of fileid #1046

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/localfs-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fixed resolution of fileid in GetPathByID.

Following refactoring of fileid generations in the
local storage provider, this ensures fileid to path
resolution works again.

https://github.com/cs3org/reva/pull/1046
10 changes: 9 additions & 1 deletion pkg/storage/utils/localfs/localfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,15 @@ func (fs *localfs) retrieveArbitraryMetadata(ctx context.Context, fn string, mdK
// GetPathByID returns the path pointed by the file id
// In this implementation the file id is in the form `fileid-url_encoded_path`
func (fs *localfs) GetPathByID(ctx context.Context, id *provider.ResourceId) (string, error) {
return url.QueryUnescape(strings.TrimPrefix(id.OpaqueId, "fileid-"))
var layout string
if !fs.conf.DisableHome {
var err error
layout, err = fs.GetHome(ctx)
if err != nil {
return "", err
}
}
return url.QueryUnescape(strings.TrimPrefix(id.OpaqueId, "fileid-"+layout))
}

func (fs *localfs) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error {
Expand Down