Skip to content

Commit

Permalink
Fix propagating etag to the parent when deleting a file
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jul 12, 2021
1 parent 009d2db commit cf22fb2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/storage/fs/owncloudsql/owncloudsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ func (fs *ocfs) CreateDir(ctx context.Context, sp string) (err error) {
}
}

return fs.propagate(ctx, ip)
return fs.propagate(ctx, filepath.Dir(ip))
}

func (fs *ocfs) CreateReference(ctx context.Context, sp string, targetURI *url.URL) error {
Expand Down Expand Up @@ -1998,9 +1998,8 @@ func (fs *ocfs) propagate(ctx context.Context, leafPath string) error {
return err
}
parts := strings.Split(strings.TrimPrefix(leafPath, root), "/")
// root never ends in / so the split returns an empty first element, which we can skip
// we do not need to chmod the last element because it is the leaf path (< and not <= comparison)
for i := 1; i < len(parts); i++ {
for i := 0; i < len(parts); i++ {
root = filepath.Join(root, parts[i])
appctx.GetLogger(ctx).Debug().
Str("leafPath", leafPath).
Str("root", root).
Expand Down Expand Up @@ -2028,7 +2027,6 @@ func (fs *ocfs) propagate(ctx context.Context, leafPath string) error {
Msg("could not set etag")
return err
}
root = filepath.Join(root, parts[i])
}
return nil
}
Expand Down

0 comments on commit cf22fb2

Please sign in to comment.