Skip to content

Commit 57f4af5

Browse files
authored
Merge pull request #65 from pavelsne/iss58
Not selecting validator results in panic (#58) resolved
2 parents 9a69674 + 1cd4b86 commit 57f4af5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

internal/resources/templates/pubvalidate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var PubValidate = `
1919
<h4>Validators</h4>
2020
<div class="inline field">
2121
<div class="ui radio checkbox">
22-
<input name="validator" value="bids" type="radio">
22+
<input name="validator" value="bids" type="radio" checked="checked">
2323
<label><strong>BIDS</strong> Brain Imaging Data Structure: link-to-bids-website</label>
2424
</div>
2525
</div>

internal/web/validate.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,12 @@ func PubValidatePost(w http.ResponseWriter, r *http.Request) {
630630

631631
r.ParseForm()
632632
repopath := r.Form["repopath"][0]
633+
validators := r.Form["validator"]
634+
if len(validators) < 1 {
635+
log.ShowWrite("[error] no validator selected")
636+
fail(w, http.StatusBadRequest, "No validator has been selected")
637+
return
638+
}
633639
validator := r.Form["validator"][0]
634640

635641
log.ShowWrite("[Info] About to validate repository '%s' with %s", repopath, ginuser)

0 commit comments

Comments
 (0)