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