Skip to content

Commit 40666eb

Browse files
Merge pull request ipfs/kubo#4672 from ipfs/feat/coreapi-paths
Improve paths in CoreApi This commit was moved from ipfs/kubo@9bad5fe
2 parents 738fccb + 60949cd commit 40666eb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

gateway/core/corehttp/gateway_handler.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"time"
1414

1515
core "github.com/ipfs/go-ipfs/core"
16-
coreapi "github.com/ipfs/go-ipfs/core/coreapi"
1716
coreiface "github.com/ipfs/go-ipfs/core/coreapi/interface"
1817
"github.com/ipfs/go-ipfs/importer"
1918
dag "github.com/ipfs/go-ipfs/merkledag"
@@ -160,7 +159,7 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
160159
ipnsHostname = true
161160
}
162161

163-
parsedPath, err := coreapi.ParsePath(urlPath)
162+
parsedPath, err := coreiface.ParsePath(urlPath)
164163
if err != nil {
165164
webError(w, "invalid ipfs path", err, http.StatusBadRequest)
166165
return
@@ -288,7 +287,7 @@ func (i *gatewayHandler) getOrHeadHandler(ctx context.Context, w http.ResponseWr
288287
return
289288
}
290289

291-
dr, err := i.api.Unixfs().Cat(ctx, coreapi.ParseCid(ixnd.Cid()))
290+
dr, err := i.api.Unixfs().Cat(ctx, coreiface.IpfsPath(ixnd.Cid()))
292291
if err != nil {
293292
internalWebError(w, err)
294293
return

gateway/core/corehttp/gateway_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func TestGatewayGet(t *testing.T) {
171171
{"working.example.com", "/", http.StatusOK, "fnord"},
172172
{"double.example.com", "/", http.StatusOK, "fnord"},
173173
{"triple.example.com", "/", http.StatusOK, "fnord"},
174-
{"working.example.com", "/ipfs/" + k, http.StatusNotFound, "ipfs resolve -r /ipns/working.example.com/ipfs/" + k + ": no link named \"ipfs\" under " + k + "\n"},
174+
{"working.example.com", "/ipfs/" + k, http.StatusNotFound, "ipfs resolve -r /ipns/working.example.com/ipfs/" + k + ": no link by that name\n"},
175175
{"broken.example.com", "/", http.StatusNotFound, "ipfs resolve -r /ipns/broken.example.com/: " + namesys.ErrResolveFailed.Error() + "\n"},
176176
{"broken.example.com", "/ipfs/" + k, http.StatusNotFound, "ipfs resolve -r /ipns/broken.example.com/ipfs/" + k + ": " + namesys.ErrResolveFailed.Error() + "\n"},
177177
} {

0 commit comments

Comments
 (0)