mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-10-27 03:29:58 -04:00
Use strings.TrimPrefix to simplify code
This commit is contained in:
1 parent
6205d41c86
commit
58f00893c7
1 file changed
+2
-3
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
bf "gopkg.in/russross/blackfriday.v2"
|
||||
@@ -163,9 +164,7 @@ func resolveRelativeURL(baseURL string, rel string) string {
|
||||
if u.IsAbs() {
|
||||
return rel
|
||||
}
|
||||
if len(u.Path) > 0 && u.Path[0] == '/' {
|
||||
u.Path = u.Path[1:]
|
||||
}
|
||||
u.Path = strings.TrimPrefix(u.Path, "/")
|
||||
|
||||
base, err := url.Parse(baseURL)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user