From 8e0b23b9e714bdbdb616cd38ac1e60d3f253c0ca Mon Sep 17 00:00:00 2001 From: Hugo Gonzalez Labrador Date: Mon, 15 Feb 2021 15:45:06 +0100 Subject: [PATCH] just create ref-dir --- pkg/storage/utils/eosfs/eosfs.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index 123c5286ea..4b71e2f071 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -973,11 +973,6 @@ func (fs *eosfs) CreateDir(ctx context.Context, p string) error { func (fs *eosfs) CreateReference(ctx context.Context, p string, targetURI *url.URL) error { // TODO(labkode): for the time being we only allow to create references // on the virtual share folder to not pollute the nominal user tree. - u, err := getUser(ctx) - if err != nil { - return errors.Wrap(err, "eos: no user in ctx") - } - if !fs.isShareFolder(ctx, p) { return errtypes.PermissionDenied("eos: cannot create references outside the share folder: share_folder=" + fs.conf.ShareFolder + " path=" + p) } @@ -993,9 +988,10 @@ func (fs *eosfs) CreateReference(ctx context.Context, p string, targetURI *url.U return nil } - if err := fs.createUserDir(ctx, u, tmp, false); err != nil { - err = errors.Wrapf(err, "eos: error creating temporary ref file") - return err + err = fs.c.CreateDir(ctx, uid, gid, tmp) + if err != nil { + // EOS will return success on mkdir over an existing directory. + return errors.Wrap(err, "eos: error creating ref-dir") } // set xattr on ref