Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/ipld/go-codec-dagpb v1.7.0
github.com/ipld/go-fixtureplate v0.1.0
github.com/ipld/go-ipld-prime v0.21.0
github.com/ipld/go-trustless-utils v0.6.0
github.com/ipld/go-trustless-utils v0.7.0
github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4
github.com/ipni/go-libipni v0.7.1
github.com/ipni/index-provider v0.15.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ github.com/ipld/go-ipld-prime v0.21.0 h1:n4JmcpOlPDIxBcY037SVfpd1G+Sj1nKZah0m6QH
github.com/ipld/go-ipld-prime v0.21.0/go.mod h1:3RLqy//ERg/y5oShXXdx5YIp50cFGOanyMctpPjsvxQ=
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20250821084354-a425e60cd714 h1:cqNk8PEwHnK0vqWln+U/YZhQc9h2NB3KjUjDPZo5Q2s=
github.com/ipld/go-ipld-prime/storage/bsadapter v0.0.0-20250821084354-a425e60cd714/go.mod h1:ZEUdra3CoqRVRYgAX/jAJO9aZGz6SKtKEG628fHHktY=
github.com/ipld/go-trustless-utils v0.6.0 h1:Yy9L+HI2AQwlq5EQPr3ZyAKbkBz/BpojqGAvym0s2lA=
github.com/ipld/go-trustless-utils v0.6.0/go.mod h1:inKRRT3L9BT1r/u6yBbXuIq+wIGO2yf0NqiOo36bH9U=
github.com/ipld/go-trustless-utils v0.7.0 h1:iKFR4f9MdPw/cM0AMz7Ss+QGyTh5RylCAjOEd4VqPXE=
github.com/ipld/go-trustless-utils v0.7.0/go.mod h1:inKRRT3L9BT1r/u6yBbXuIq+wIGO2yf0NqiOo36bH9U=
github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4 h1:0VXv637/xpI0Pb5J8K+K8iRtTw4DOcxs0MB1HMzfwNY=
github.com/ipld/ipld/specs v0.0.0-20231012031213-54d3b21deda4/go.mod h1:WcT0DfRe+e2QFY0kcbsOnuT6jL5Q0JNZ83I5DHIdStg=
github.com/ipni/go-libipni v0.7.1 h1:0peyJTXXgrDHqjiqpSuYlxH3JIvnUMw1Orq7nJtq/tY=
Expand Down
18 changes: 4 additions & 14 deletions httpipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,21 +255,11 @@ func NewHttpIpfsHandlerFunc(
}
accept := accepts[0]

// Parse filename parameter - trustlesshttp.ParseFilename only accepts .car
// but frisbii also supports raw responses with .bin, so we handle that case
fileName, err := trustlesshttp.ParseFilename(req)
// Parse filename parameter - supports both .car and .bin extensions
fileName, err := trustlesshttp.ParseFilename(req, accepts)
if err != nil {
// If ParseFilename failed, check if it's because of .bin extension for raw response
if accept.IsRaw() && req.URL.Query().Get("filename") != "" {
fileName = req.URL.Query().Get("filename")
if !strings.HasSuffix(fileName, ".bin") {
logError(http.StatusBadRequest, fmt.Errorf("invalid filename parameter for raw response; expected .bin extension"))
return
}
} else {
logError(http.StatusBadRequest, err)
return
}
logError(http.StatusBadRequest, err)
return
}

// validate CID path parameter
Expand Down