Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit c92b18b

Browse files
authored
Merge pull request #101 from ipfs/fix/resolve
Switch ResolvePath to use /resolve
2 parents 88adb78 + ebd612c commit c92b18b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

shell.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ func (s *Shell) NewObject(template string) (string, error) {
583583
}
584584

585585
func (s *Shell) ResolvePath(path string) (string, error) {
586-
resp, err := s.newRequest(context.Background(), "object/stat", path).Send(s.httpcli)
586+
resp, err := s.newRequest(context.Background(), "resolve", path).Send(s.httpcli)
587587
if err != nil {
588588
return "", err
589589
}
@@ -593,13 +593,17 @@ func (s *Shell) ResolvePath(path string) (string, error) {
593593
return "", resp.Error
594594
}
595595

596-
var out object
596+
var out struct {
597+
Path string
598+
}
597599
err = json.NewDecoder(resp.Output).Decode(&out)
598600
if err != nil {
599601
return "", err
600602
}
601603

602-
return out.Hash, nil
604+
p := strings.TrimPrefix(out.Path, "/ipfs/")
605+
606+
return p, nil
603607
}
604608

605609
// returns ipfs version and commit sha

0 commit comments

Comments
 (0)