Skip to content

Commit 0e15789

Browse files
authored
Merge pull request ipfs/kubo#9098 from ipfs/fix/post-rename-papercuts
Follow-ups after repository rename Context: ipfs/kubo#8959 This commit was moved from ipfs/kubo@9ce802f
2 parents 1826a07 + 65a77e8 commit 0e15789

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gateway/core/corehttp/commands.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func addHeadersFromConfig(c *cmdsHttp.ServerConfig, nc *config.Config) {
8585
c.Headers[h] = v
8686
}
8787
}
88-
c.Headers["Server"] = []string{"go-ipfs/" + version.CurrentVersionNumber}
88+
c.Headers["Server"] = []string{"kubo/" + version.CurrentVersionNumber}
8989
}
9090

9191
func addCORSDefaults(c *cmdsHttp.ServerConfig) {
@@ -163,7 +163,7 @@ func CommandsROOption(cctx oldcmds.Context) ServeOption {
163163
return commandsOption(cctx, corecommands.RootRO, true)
164164
}
165165

166-
// CheckVersionOption returns a ServeOption that checks whether the client ipfs version matches. Does nothing when the user agent string does not contain `/go-ipfs/`
166+
// 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/`
167167
func CheckVersionOption() ServeOption {
168168
daemonVersion := version.ApiVersion
169169

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

0 commit comments

Comments
 (0)