Skip to content

Commit

Permalink
LocalFS: Fixed resolution of fileid
Browse files Browse the repository at this point in the history
  • Loading branch information
glpatcern committed Aug 3, 2020
1 parent 7e2d7e0 commit 6b5b228
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog/unreleased/localfs-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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.

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

0 comments on commit 6b5b228

Please sign in to comment.