Skip to content

Commit

Permalink
Merge pull request ipfs/go-ipfs-files#23 from ipfs/revert/symlink-con…
Browse files Browse the repository at this point in the history
…structor-change

revert(symlink): keep stat argument

This commit was moved from ipfs/go-ipfs-files@96cf7c9
  • Loading branch information
Stebalien committed Sep 26, 2019
2 parents 92aa596 + dbc14ee commit a62d4bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions files/linkfile.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package files

import (
"os"
"strings"
)

type Symlink struct {
Target string

stat os.FileInfo
reader strings.Reader
}

func NewLinkFile(target string) File {
lf := &Symlink{Target: target}
func NewLinkFile(target string, stat os.FileInfo) File {
lf := &Symlink{Target: target, stat: stat}
lf.reader.Reset(lf.Target)
return lf
}
Expand Down
2 changes: 1 addition & 1 deletion files/multipartfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (w *multipartWalker) nextFile() (Node, error) {
return nil, err
}

return NewLinkFile(string(out)), nil
return NewLinkFile(string(out), nil), nil
default:
return &ReaderFile{
reader: part,
Expand Down
2 changes: 1 addition & 1 deletion files/serialfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewSerialFile(path string, hidden bool, stat os.FileInfo) (Node, error) {
if err != nil {
return nil, err
}
return NewLinkFile(target), nil
return NewLinkFile(target, stat), nil
default:
return nil, fmt.Errorf("unrecognized file type for %s: %s", path, mode.String())
}
Expand Down

0 comments on commit a62d4bc

Please sign in to comment.