diff --git a/user/net.go b/user/net.go index 45da976..48b70f1 100644 --- a/user/net.go +++ b/user/net.go @@ -45,13 +45,13 @@ func Register(username, password, group, source string, force bool) error { switch { case !util.IsPossibleUsername(username): - return fmt.Errorf("illegal username \"%s\"", username) + return fmt.Errorf("illegal username ‘%s’", username) case !ValidGroup(group): - return fmt.Errorf("invalid group \"%s\"", group) + return fmt.Errorf("invalid group ‘%s’", group) case !ValidSource(source): - return fmt.Errorf("invalid source \"%s\"", source) + return fmt.Errorf("invalid source ‘%s’", source) case HasUsername(username): - return fmt.Errorf("username \"%s\" is already taken", username) + return fmt.Errorf("username ‘%s’ is already taken", username) case !force && cfg.RegistrationLimit > 0 && Count() >= cfg.RegistrationLimit: return fmt.Errorf("reached the limit of registered users (%d)", cfg.RegistrationLimit) } diff --git a/web/admin.go b/web/admin.go index dbaf960..8bb8651 100644 --- a/web/admin.go +++ b/web/admin.go @@ -2,11 +2,11 @@ package web import ( "fmt" - "os" "io" "log" "mime" "net/http" + "os" "sort" "github.com/gorilla/mux" @@ -99,7 +99,7 @@ func handlerAdminUserEdit(w http.ResponseWriter, rq *http.Request) { return } } else { - f = f.WithError(fmt.Errorf("invalid group \"%s\"", newGroup)) + f = f.WithError(fmt.Errorf("invalid group ‘%s’", newGroup)) } } diff --git a/web/auth.go b/web/auth.go index 8419167..beb0283 100644 --- a/web/auth.go +++ b/web/auth.go @@ -60,7 +60,7 @@ func handlerRegister(w http.ResponseWriter, rq *http.Request) { err = user.Register(username, password, "editor", "local", false) ) if err != nil { - log.Printf("Failed to register \"%s\": %s", username, err.Error()) + log.Printf("Failed to register ‘%s’: %s", username, err.Error()) w.Header().Set("Content-Type", mime.TypeByExtension(".html")) w.WriteHeader(http.StatusBadRequest) fmt.Fprint( @@ -75,7 +75,7 @@ func handlerRegister(w http.ResponseWriter, rq *http.Request) { ), ) } else { - log.Printf("Successfully registered \"%s\"", username) + log.Printf("Successfully registered ‘%s’", username) user.LoginDataHTTP(w, rq, username, password) http.Redirect(w, rq, "/"+rq.URL.RawQuery, http.StatusSeeOther) } diff --git a/web/history.go b/web/history.go index b35519c..450b248 100644 --- a/web/history.go +++ b/web/history.go @@ -40,7 +40,7 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) { log.Println("Found", len(revs), "revisions for", hyphaName) util.HTTP200Page(w, views.BaseHTML( - fmt.Sprintf("History of \"%s\"", util.BeautifulName(hyphaName)), + fmt.Sprintf("History of %s", util.BeautifulName(hyphaName)), views.HistoryHTML(rq, hyphaName, list), user.FromRequest(rq))) } diff --git a/web/mutators.go b/web/mutators.go index 313d77b..ed6b6d6 100644 --- a/web/mutators.go +++ b/web/mutators.go @@ -57,7 +57,7 @@ func factoryHandlerAsker( util.HTTP200Page( w, views.BaseHTML( - fmt.Sprintf(succTitleTemplate, hyphaName), + fmt.Sprintf(succTitleTemplate, util.BeautifulName(hyphaName)), succPageTemplate(rq, hyphaName, h.Exists), u)) } @@ -163,7 +163,7 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) { util.HTTP200Page( w, views.BaseHTML( - fmt.Sprintf("Edit \"%s\"", util.BeautifulName(hyphaName)), + fmt.Sprintf("Edit %s", util.BeautifulName(hyphaName)), views.EditHTML(rq, hyphaName, textAreaFill, warning), u)) } @@ -198,7 +198,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) { util.HTTP200Page( w, views.BaseHTML( - fmt.Sprintf("Preview of \"%s\"", util.BeautifulName(hyphaName)), + fmt.Sprintf("Preview of %s", util.BeautifulName(hyphaName)), views.PreviewHTML( rq, hyphaName, diff --git a/web/readers.go b/web/readers.go index d5b25f0..10b610e 100644 --- a/web/readers.go +++ b/web/readers.go @@ -41,7 +41,7 @@ func handlerAttachment(w http.ResponseWriter, rq *http.Request) { ) util.HTTP200Page(w, views.BaseHTML( - fmt.Sprintf("Attachment of \"%s\"", util.BeautifulName(hyphaName)), + fmt.Sprintf("Attachment of %s", util.BeautifulName(hyphaName)), views.AttachmentMenuHTML(rq, h, u), u)) } @@ -58,7 +58,7 @@ func handlerPrimitiveDiff(w http.ResponseWriter, rq *http.Request) { ) util.HTTP200Page(w, views.BaseHTML( - fmt.Sprintf("Diff of \"%s\" at %s", util.BeautifulName(hyphaName), revHash), + fmt.Sprintf("Diff of %s at %s", util.BeautifulName(hyphaName), revHash), views.PrimitiveDiffHTML(rq, h, u, revHash), u)) } @@ -88,7 +88,14 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) { ) w.Header().Set("Content-Type", "text/html;charset=utf-8") w.WriteHeader(http.StatusOK) - _, _ = fmt.Fprint(w, views.BaseHTML(util.BeautifulName(hyphaName), page, u)) + _, _ = fmt.Fprint( + w, + views.BaseHTML( + fmt.Sprintf(`%s at %s`, util.BeautifulName(hyphaName), revHash), + page, + u, + ), + ) } // handlerText serves raw source text of the hypha.