target: Simplify
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 23 Nov 2016 17:46:32 +0000 (18:46 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 23 Nov 2016 17:46:32 +0000 (18:46 +0100)
target/htmlredirect.go

index 20e064c88c9148880b153ff028a707eace5bafdf..81a15fa737488b7ade95a5bc38689faeaa0a7ad2 100644 (file)
@@ -104,9 +104,7 @@ func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error
        }
 
        // Add the final touch
-       if strings.HasPrefix(alias, helpers.FilePathSeparator) {
-               alias = alias[1:]
-       }
+       alias = strings.TrimPrefix(alias, helpers.FilePathSeparator)
        if strings.HasSuffix(alias, helpers.FilePathSeparator) {
                alias = alias + "index.html"
        } else if !strings.HasSuffix(alias, ".html") {