Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions tar/walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import (
"compress/gzip"
"context"
"fmt"
"github.com/viant/afs/file"
"github.com/viant/afs/object"
"github.com/viant/afs/option"
"github.com/viant/afs/storage"
"github.com/viant/afs/url"
"io"
"io/ioutil"
"os"
"path"
"strings"

"github.com/viant/afs/file"
"github.com/viant/afs/object"
"github.com/viant/afs/option"
"github.com/viant/afs/storage"
"github.com/viant/afs/url"
)

type walker struct {
Expand Down Expand Up @@ -132,6 +133,9 @@ func (w *walker) Walk(ctx context.Context, URL string, handler storage.OnVisit,
if ioReader, err = w.fetch(tar.NewReader(linkReader), linkPath, cache); err == nil {
shallContinue, err = visitSymlinkHeader(ctx, header, linkPath, ioReader, handler, URL, relative, info)
}
if err != nil {
return err
}
linkReader.Close()
default:
return fmt.Errorf("unknown header type: %v", header.Typeflag)
Expand All @@ -155,6 +159,9 @@ func (w *walker) uncompressIfNeeded(readerCloser io.ReadCloser) (io.ReadCloser,
}
_ = gzReader.Close()
data, err = ioutil.ReadAll(gzReader)
if err != nil {
return nil, err
}
return ioutil.NopCloser(bytes.NewReader(data)), nil
}

Expand Down