~ols/yeet

9d8c7b7c2acb7eb66667c7b82a62681a4d789a8c — Ted Unangst 3 years ago 980a697
more relaxed name check for honker
2 files changed, 4 insertions(+), 3 deletions(-)

M util.go
M web.go
M util.go => util.go +1 -1
@@ 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 {

M web.go => web.go +3 -2
@@ 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 {