shithub: mycel

Download patch

ref: 2b0707b83858f8fecb4de49776126c482abfce34
parent: 2e8eb15b7f930db7469914a1ce70bdec608a9349
author: Philip Silva <[email protected]>
date: Sun Jan 31 06:03:56 EST 2021

fix double-slashes in relative links

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -1246,7 +1246,7 @@
 		addr = b.URL().Scheme + "://" + b.URL().Host + addr
 	} else if !strings.HasPrefix(addr, "http") {
 		if strings.HasSuffix(b.URL().Path, "/") {
-			addr = "/" + b.URL().Path + "/" + addr
+			addr = "/" + b.URL().Path + addr
 		} else {
 			m := strings.LastIndex(b.URL().Path, "/")
 			if m > 0 {
--- a/browser/browser_test.go
+++ b/browser/browser_test.go
@@ -112,6 +112,11 @@
 			href: "net/http",
 			expect: "https://golang.org/pkg/net/http",
 		},
+		item{
+			orig: "https://example.com/",
+			href: "info",
+			expect: "https://example.com/info",
+		},
 	}
 
 	for _, i := range items {