diff --git a/util.go b/util.go index aee4ee7..f034989 100644 --- a/util.go +++ b/util.go @@ -55,7 +55,7 @@ import ( var savedassetparams = make(map[string]string) -var re_plainname = regexp.MustCompile("^[[:alnum:]]+$") +var re_plainname = regexp.MustCompile("^[[:alnum:]_-]+$") func getassetparam(file string) string { if p, ok := savedassetparams[file]; ok { diff --git a/web.go b/web.go index 74d8be0..600f28b 100644 --- a/web.go +++ b/web.go @@ -1851,7 +1851,8 @@ func submithonker(w http.ResponseWriter, r *http.Request) { combos = " " + combos + " " honkerid, _ := strconv.ParseInt(r.FormValue("honkerid"), 10, 0) - if name != "" && !re_plainname.MatchString(name) { + re_namecheck := regexp.MustCompile("[[:alnum:]_.-]+") + if name != "" && !re_namecheck.MatchString(name) { http.Error(w, "please use a plainer name", http.StatusInternalServerError) return } @@ -1897,7 +1898,7 @@ func submithonker(w http.ResponseWriter, r *http.Request) { if url[0] == '#' { flavor = "peep" if name == "" { - name = url + name = url[1:] } _, err := stmtSaveHonker.Exec(u.UserID, name, url, flavor, combos, url, mj) if err != nil {