diff --git a/pkg/object/prefix.go b/pkg/object/prefix.go index 36b62f766de4..b8db3c96d6b0 100644 --- a/pkg/object/prefix.go +++ b/pkg/object/prefix.go @@ -207,3 +207,11 @@ func (p *withPrefix) ListUploads(marker string) ([]*PendingPart, string, error) } var _ ObjectStorage = &withPrefix{} + +func IsFileSystem(object ObjectStorage) bool { + if o, ok := object.(*withPrefix); ok { + object = o.os + } + _, ok := object.(FileSystem) + return ok +} diff --git a/pkg/sync/sync.go b/pkg/sync/sync.go index 85f2d401f4e5..ca40898ab20e 100644 --- a/pkg/sync/sync.go +++ b/pkg/sync/sync.go @@ -405,6 +405,14 @@ SINGLE: var in io.ReadCloser var err error if size == 0 { + if object.IsFileSystem(src) { + // for check permissions + r, err := src.Get(key, 0, -1) + if err != nil { + return err + } + _ = r.Close() + } in = io.NopCloser(bytes.NewReader(nil)) } else { in, err = src.Get(key, 0, size)