Ensure that BaseUrl used in `hugo server` ends with `/` - hugo - [fork] hugo port for 9front
(HTM) git clone git@git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit 1cbdd3e59df6c4513ea8e83aadc969272420ca52
(DIR) parent 9150a98f3ed0f9b7732e80eb181194532bc2e189
(HTM) Author: Anthony Fok <foka@debian.org>
Date: Thu, 15 Jan 2015 18:02:19 -0700
Ensure that BaseUrl used in `hugo server` ends with `/`
Fixes #793, #799
Diffstat:
M commands/server.go | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/commands/server.go b/commands/server.go
@@ -135,6 +135,8 @@ func serve(port int) {
}
}
+// fixUrl massages the BaseUrl into a form needed for serving
+// all pages correctly.
func fixUrl(s string) (string, error) {
useLocalhost := false
if s == "" {
@@ -144,6 +146,9 @@ func fixUrl(s string) (string, error) {
if !strings.HasPrefix(s, "http://") && !strings.HasPrefix(s, "https://") {
s = "http://" + s
}
+ if !strings.HasSuffix(s, "/") {
+ s = s + "/"
+ }
u, err := url.Parse(s)
if err != nil {
return "", err