all repos — honk @ 89bb398fdd7383ce83a566a67733b30ff6e62ff1

my fork of honk

check honker name is plain
Ted Unangst tedu@tedunangst.com
Wed, 25 Nov 2020 21:55:25 -0500
commit

89bb398fdd7383ce83a566a67733b30ff6e62ff1

parent

3dfb48563b05ab72f0c7ca7ce5ab30d50cfa3f80

2 files changed, 8 insertions(+), 2 deletions(-)

jump to
M util.goutil.go

@@ -55,6 +55,8 @@ )

var savedassetparams = make(map[string]string) +var re_plainname = regexp.MustCompile("^[[:alnum:]]+$") + func getassetparam(file string) string { if p, ok := savedassetparams[file]; ok { return p

@@ -309,8 +311,7 @@ name = name[:len(name)-1]

if len(name) < 1 { return fmt.Errorf("that's way too short") } - re_name := regexp.MustCompile("^[[:alnum:]]+$") - if !re_name.MatchString(name) { + if !re_plainname.MatchString(name) { return fmt.Errorf("alphanumeric only please") } if _, err := butwhatabout(name); err == nil {
M web.goweb.go

@@ -1840,6 +1840,11 @@ combos := strings.TrimSpace(r.FormValue("combos"))

combos = " " + combos + " " honkerid, _ := strconv.ParseInt(r.FormValue("honkerid"), 10, 0) + if name != "" && !re_plainname.MatchString(name) { + http.Error(w, "please use a plainer name", http.StatusInternalServerError) + return + } + var meta HonkerMeta meta.Notes = strings.TrimSpace(r.FormValue("notes")) mj, _ := jsonify(&meta)