Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarthelmes committed Oct 24, 2021
1 parent 58393b4 commit 2856154
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions fsrefstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (f *FileManager) readFileDataObj(m mh.Multihash, d *pb.DataObj) ([]byte, er
}

p := filepath.FromSlash(d.GetFilePath())
abspath := filepath.Join(f.root, p)
abspath := p

fi, err := os.Open(abspath)
if os.IsNotExist(err) {
Expand Down Expand Up @@ -290,17 +290,8 @@ func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error {
if !f.AllowFiles {
return ErrFilestoreNotEnabled
}
//lint:ignore SA1019 // ignore staticcheck
if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) {
return fmt.Errorf("cannot add filestore references outside ipfs root (%s)", f.root)
}

p, err := filepath.Rel(f.root, b.PosInfo.FullPath)
if err != nil {
return err
}

dobj.FilePath = filepath.ToSlash(p)
dobj.FilePath = filepath.ToSlash(b.PosInfo.FullPath)
}
dobj.Offset = b.PosInfo.Offset
dobj.Size_ = uint64(len(b.RawData()))
Expand Down

0 comments on commit 2856154

Please sign in to comment.