Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
Merged
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
10 changes: 7 additions & 3 deletions shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ func (s *Shell) NewObject(template string) (string, error) {
}

func (s *Shell) ResolvePath(path string) (string, error) {
resp, err := s.newRequest(context.Background(), "object/stat", path).Send(s.httpcli)
resp, err := s.newRequest(context.Background(), "resolve", path).Send(s.httpcli)
if err != nil {
return "", err
}
Expand All @@ -593,13 +593,17 @@ func (s *Shell) ResolvePath(path string) (string, error) {
return "", resp.Error
}

var out object
var out struct {
Path string
}
err = json.NewDecoder(resp.Output).Decode(&out)
if err != nil {
return "", err
}

return out.Hash, nil
p := strings.TrimPrefix(out.Path, "/ipfs/")

return p, nil
}

// returns ipfs version and commit sha
Expand Down