@cryptotaxi247 / kubo / commits / 64a4c2791

corehttp: allow all webui paths we published.

Otherwise we break users links! cc @mappum

Juan Batiz-Benet committed Feb 6, 2015 at 07:30 UTC 64a4c27913318530b460500d1aafceaa476a773c
2 files changed +13 -2
cmd/ipfs/daemon.go
+7 -2
@@ -195,8 +195,13 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
195
196 blocklist := &corehttp.BlockList{}
197 blocklist.SetDecider(func(s string) bool {
198 - // only allow paths that begin with the WebUI path
199 - return strings.HasPrefix(s, corehttp.WebUIPath)
198 + // for now, only allow paths in the WebUI path
199 + for _, webuipath := range corehttp.WebUIPaths {
200 + if strings.HasPrefix(s, webuipath) {
201 + return true
202 + }
203 + }
204 + return false
205 })
206 gatewayConfig := corehttp.GatewayConfig{
207 Writable: true,
core/corehttp/webui.go
+6
@@ -3,4 +3,10 @@ package corehttp
3 // TODO: move to IPNS
4 const WebUIPath = "/ipfs/QmSHDxWsMPuJQKWmVA1rB5a3NX2Eme5fPqNb63qwaqiqSp"
5
6 +// this is a list of all past webUI paths.
7 +var WebUIPaths = []string{
8 + WebUIPath,
9 + "/ipfs/QmctngrQAt9fjpQUZr7Bx3BsXUcif52eZGTizWhvcShsjz",
10 +}
11 +
12 var WebUIOption = RedirectOption("webui", WebUIPath)