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 Feb 13, 2020
1 parent 40cc04f commit 704ce63
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions fsrefstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (f *FileManager) readFileDataObj(c cid.Cid, d *pb.DataObj) ([]byte, error)
}

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 @@ -281,16 +281,8 @@ func (f *FileManager) putTo(b *posinfo.FilestoreNode, to putter) error {
if !f.AllowFiles {
return ErrFilestoreNotEnabled
}
if !filepath.HasPrefix(b.PosInfo.FullPath, f.root) { //nolint:staticcheck
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 704ce63

Please sign in to comment.