From 1b3797474f4f5a8a9be533da8c7eca2372d2befe Mon Sep 17 00:00:00 2001
From: Knut Ahlers <knut@ahlers.me>
Date: Sat, 16 May 2015 15:12:24 +0200
Subject: [PATCH] Fix: Using the `dnslink` feature led to infinite redirects

fixes #1233
---
 core/corehttp/ipns_hostname.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/corehttp/ipns_hostname.go b/core/corehttp/ipns_hostname.go
index a6e8e91f5..f651cc60f 100644
--- a/core/corehttp/ipns_hostname.go
+++ b/core/corehttp/ipns_hostname.go
@@ -2,6 +2,7 @@ package corehttp
 
 import (
 	"net/http"
+	"path"
 	"strings"
 
 	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
@@ -20,7 +21,7 @@ func IPNSHostnameOption() ServeOption {
 
 			host := strings.SplitN(r.Host, ":", 2)[0]
 			if p, err := n.Namesys.Resolve(ctx, host); err == nil {
-				r.URL.Path = p.String() + r.URL.Path
+				r.URL.Path = path.Join(p.String(), r.URL.Path)
 			}
 			childMux.ServeHTTP(w, r)
 		})
-- 
GitLab