Skip to content

Commit

Permalink
Merge pull request ipfs/kubo#2696 from ipfs/feature/Offline-2393
Browse files Browse the repository at this point in the history
Offline daemon mode

This commit was moved from ipfs/kubo@6a894d6
  • Loading branch information
whyrusleeping committed May 31, 2016
2 parents 6e60017 + 769081d commit 10b4080
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gateway/core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
}

nd, err := core.Resolve(ctx, i.node, path.Path(urlPath))
if err != nil {
// If node is in offline mode the error code and message should be different
if err == core.ErrNoNamesys && !i.node.OnlineMode() {
w.WriteHeader(http.StatusServiceUnavailable)
fmt.Fprint(w, "Could not resolve path. Node is in offline mode.")
return
} else if err != nil {
webError(w, "Path Resolve error", err, http.StatusBadRequest)
return
}
Expand Down

0 comments on commit 10b4080

Please sign in to comment.