diff --git a/views/honkform.html b/views/honkform.html index ae6cac2..b519529 100644 --- a/views/honkform.html +++ b/views/honkform.html @@ -9,8 +9,7 @@
more options

- - +


{{ with .SavedPlace }} diff --git a/web.go b/web.go index dc5d1b2..16c6a1d 100644 --- a/web.go +++ b/web.go @@ -1569,11 +1569,15 @@ func edithonkpage(w http.ResponseWriter, r *http.Request) { templinfo["Duration"] = tm.Duration } } - templinfo["ServerMessage"] = "honk edit 2" + templinfo["ServerMessage"] = "honk edit" templinfo["IsPreview"] = true templinfo["UpdateXID"] = honk.XID if len(honk.Donks) > 0 { - templinfo["SavedFile"] = honk.Donks[0].XID + var savedfiles []string + for _, d := range honk.Donks { + savedfiles = append(savedfiles, fmt.Sprintf("%s:%d", d.XID, d.FileID)) + } + templinfo["SavedFile"] = strings.Join(savedfiles, ",") } err := readviews.Execute(w, "honkpage.html", templinfo) if err != nil { @@ -1618,7 +1622,10 @@ func submitdonk(w http.ResponseWriter, r *http.Request) ([]*Donk, error) { return nil, nil } var donks []*Donk - for _, hdr := range r.MultipartForm.File["donk"] { + for i, hdr := range r.MultipartForm.File["donk"] { + if i > 16 { + break + } donk, err := formtodonk(w, r, hdr) if err != nil { return nil, err @@ -1825,7 +1832,7 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk { honk.Public = loudandproud(honk.Audience) honk.Convoy = convoy - donkxid := r.FormValue("donkxid") + donkxid := strings.Join(r.Form["donkxid"], ",") if donkxid == "" { donks, err := submitdonk(w, r) if err != nil && err != http.ErrMissingFile { @@ -1833,11 +1840,18 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk { } if len(donks) > 0 { honk.Donks = append(honk.Donks, donks...) - d := donks[0] - donkxid = fmt.Sprintf("%s:%d", d.XID, d.FileID) + var xids []string + for _, d := range honk.Donks { + xids = append(xids, fmt.Sprintf("%s:%d", d.XID, d.FileID)) + } + donkxid = strings.Join(xids, ",") } } else { - for _, xid := range r.Form["donkxid"] { + xids := strings.Split(donkxid, ",") + for i, xid := range xids { + if i > 16 { + break + } p := strings.Split(xid, ":") xid = p[0] url := fmt.Sprintf("https://%s/d/%s", serverName, xid)