Skip to content

Commit

Permalink
Merge pull request ipfs/kubo#9098 from ipfs/fix/post-rename-papercuts
Browse files Browse the repository at this point in the history
Follow-ups after repository rename
Context: ipfs/kubo#8959

This commit was moved from ipfs/kubo@9ce802f
  • Loading branch information
lidel committed Jul 6, 2022
2 parents 1826a07 + 65a77e8 commit 0e15789
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gateway/core/corehttp/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
c.Headers[h] = v
}
}
c.Headers["Server"] = []string{"go-ipfs/" + version.CurrentVersionNumber}
c.Headers["Server"] = []string{"kubo/" + version.CurrentVersionNumber}
}

func addCORSDefaults(c *cmdsHttp.ServerConfig) {
Expand Down Expand Up @@ -163,7 +163,7 @@ func CommandsROOption(cctx oldcmds.Context) ServeOption {
return commandsOption(cctx, corecommands.RootRO, true)
}

// CheckVersionOption returns a ServeOption that checks whether the client ipfs version matches. Does nothing when the user agent string does not contain `/go-ipfs/`
// CheckVersionOption returns a ServeOption that checks whether the client ipfs version matches. Does nothing when the user agent string does not contain `/kubo/` or `/go-ipfs/`
func CheckVersionOption() ServeOption {
daemonVersion := version.ApiVersion

Expand All @@ -177,8 +177,8 @@ func CheckVersionOption() ServeOption {
// backwards compatibility to previous version check
if len(pth) >= 2 && pth[1] != "version" {
clientVersion := r.UserAgent()
// skips check if client is not go-ipfs
if strings.Contains(clientVersion, "/go-ipfs/") && daemonVersion != clientVersion {
// skips check if client is not kubo (go-ipfs)
if (strings.Contains(clientVersion, "/go-ipfs/") || strings.Contains(clientVersion, "/kubo/")) && daemonVersion != clientVersion {
http.Error(w, fmt.Sprintf("%s (%s != %s)", errAPIVersionMismatch, daemonVersion, clientVersion), http.StatusBadRequest)
return
}
Expand Down

0 comments on commit 0e15789

Please sign in to comment.