Small validatin improvement

This commit is contained in:
Dominic Ferrando
2025-04-23 14:16:56 -04:00
parent a559aaebf4
commit cdef2c03be
3 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -165,7 +165,7 @@ func main() {
body := strings.TrimSpace(r.FormValue("body"))
if len(subject) > util.MAX_SUBJECT_LEN {
http.Error(w, fmt.Sprintf("Subject exceeds %d characters", util.MAX_BODY_LEN), http.StatusBadRequest)
http.Error(w, fmt.Sprintf("Subject exceeds %d characters", util.MAX_SUBJECT_LEN), http.StatusBadRequest)
return
}
+2 -3
View File
@@ -3,7 +3,6 @@ package shared
import "github.com/dominicf2001/comfychan/internal/database"
import "strings"
import "github.com/dominicf2001/comfychan/internal/util"
import "strconv"
templ NewPostForm(board database.Board, endpoint string, isForThread bool) {
<div style="display: none;" id="newPostWarning" class="warning"></div>
@@ -37,11 +36,11 @@ templ NewPostForm(board database.Board, endpoint string, isForThread bool) {
class="new-post-form-field"
>
<th>Subject</th>
<td><input maxlength={ strconv.Itoa(util.MAX_SUBJECT_LEN) } id="newPostSubject" name="subject"/></td>
<td><input id="newPostSubject" name="subject"/></td>
</tr>
<tr class="new-post-form-field">
<th>Comment</th>
<td><textarea maxlength={ strconv.Itoa(util.MAX_BODY_LEN) } id="newPostBody" name="body" required></textarea></td>
<td><textarea id="newPostBody" name="body" required></textarea></td>
</tr>
<tr class="new-post-form-field">
<th>File</th>