mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 18:57:57 +08:00
fix: abort when we fail to resolve CIDs
I believe we figured that these were for "informational purposes", but really, we _should_ always be able to resolve names to CIDs. If we can't, there's probably something wrong with the directory.
This commit is contained in:
parent
0858dc62aa
commit
66a76d27f3
@ -391,11 +391,12 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
|
||||
size = humanize.Bytes(uint64(s))
|
||||
}
|
||||
|
||||
hash := ""
|
||||
if r, err := i.api.ResolvePath(r.Context(), ipath.Join(resolvedPath, dirit.Name())); err == nil {
|
||||
// Path may not be resolved. Continue anyways.
|
||||
hash = r.Cid().String()
|
||||
resolved, err := i.api.ResolvePath(r.Context(), ipath.Join(resolvedPath, dirit.Name()))
|
||||
if err != nil {
|
||||
internalWebError(w, err)
|
||||
return
|
||||
}
|
||||
hash := resolved.Cid().String()
|
||||
|
||||
// See comment above where originalUrlPath is declared.
|
||||
di := directoryItem{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user