Skip to content

Commit

Permalink
fix stat file for a read only share
Browse files Browse the repository at this point in the history
  • Loading branch information
gmgigi96 committed Apr 3, 2023
1 parent 525d849 commit 0b24a14
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/eosclient/eosbinary/eosbinary.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ func (c *Client) GetFileInfoByPath(ctx context.Context, auth eosclient.Authoriza
}

if c.opt.VersionInvariant && !isVersionFolder(path) && !info.IsDir {
if inode, err := c.getVersionFolderInode(ctx, auth, path); err == nil {
ownerAuth := eosclient.Authorization{Role: eosclient.Role{
UID: strconv.FormatUint(info.UID, 10),
GID: strconv.FormatUint(info.GID, 10),
}}
if inode, err := c.getVersionFolderInode(ctx, auth, ownerAuth, path); err == nil {
info.Inode = inode
}
}
Expand Down Expand Up @@ -837,11 +841,11 @@ func (c *Client) GenerateToken(ctx context.Context, auth eosclient.Authorization
return strings.TrimSpace(stdout), err
}

func (c *Client) getVersionFolderInode(ctx context.Context, auth eosclient.Authorization, p string) (uint64, error) {
func (c *Client) getVersionFolderInode(ctx context.Context, auth, ownerAuth eosclient.Authorization, p string) (uint64, error) {
versionFolder := getVersionFolder(p)
md, err := c.getRawFileInfoByPath(ctx, auth, versionFolder)
if err != nil {
if err = c.CreateDir(ctx, auth, versionFolder); err != nil {
if err = c.CreateDir(ctx, ownerAuth, versionFolder); err != nil {
return 0, err
}
md, err = c.getRawFileInfoByPath(ctx, auth, versionFolder)
Expand Down

0 comments on commit 0b24a14

Please sign in to comment.