Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-02 02:21:02 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-03-02 02:21:39 +0300
commit7acec3c63991f5f3f5907e6e3b3f531d77fa97c8 (patch)
tree2625439a5825982a33716d039f0a5d33c51aba35 /helpers/url.go
parent74ea81b885adc64d0194df461cbc85667294d16e (diff)
helpers: Return partially cleaned URL in case of error in URLPrep anyway
Closes #2987
Diffstat (limited to 'helpers/url.go')
-rw-r--r--helpers/url.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/helpers/url.go b/helpers/url.go
index 3a060eee9..bf617ff16 100644
--- a/helpers/url.go
+++ b/helpers/url.go
@@ -20,7 +20,6 @@ import (
"strings"
"github.com/PuerkitoBio/purell"
- jww "github.com/spf13/jwalterweatherman"
)
type pathBridge struct {
@@ -297,17 +296,15 @@ func (p *PathSpec) URLizeAndPrep(in string) string {
// URLPrep applies misc sanitation to the given URL.
func (p *PathSpec) URLPrep(in string) string {
if p.uglyURLs {
- x := Uglify(SanitizeURL(in))
- return x
+ return Uglify(SanitizeURL(in))
}
- x := PrettifyURL(SanitizeURL(in))
- if path.Ext(x) == ".xml" {
- return x
+ pretty := PrettifyURL(SanitizeURL(in))
+ if path.Ext(pretty) == ".xml" {
+ return pretty
}
- url, err := purell.NormalizeURLString(x, purell.FlagAddTrailingSlash)
+ url, err := purell.NormalizeURLString(pretty, purell.FlagAddTrailingSlash)
if err != nil {
- jww.ERROR.Printf("Failed to normalize URL string. Returning in = %q\n", in)
- return in
+ return pretty
}
return url
}