@@ -505,6 +505,13 @@ func Root(w http.ResponseWriter, r *http.Request) {
505
505
// to manually run a validator on a publicly accessible repository, without
506
506
// using a web hook.
507
507
func PubValidateGet (w http.ResponseWriter , r * http.Request ) {
508
+ renderValidationForm (w , r , "" )
509
+ }
510
+
511
+ // renderValidationForm renders the one-time validation form, which allows the user
512
+ // to manually run a validator on a publicly accessible repository, without
513
+ // using a web hook.
514
+ func renderValidationForm (w http.ResponseWriter , r * http.Request , errMsg string ) {
508
515
tmpl := template .New ("layout" )
509
516
tmpl , err := tmpl .Parse (templates .Layout )
510
517
if err != nil {
@@ -521,11 +528,13 @@ func PubValidateGet(w http.ResponseWriter, r *http.Request) {
521
528
year , _ , _ := time .Now ().Date ()
522
529
srvcfg := config .Read ()
523
530
data := struct {
524
- GinURL string
525
- CurrentYear int
531
+ GinURL string
532
+ CurrentYear int
533
+ ErrorMessage string
526
534
}{
527
535
srvcfg .GINAddresses .WebURL ,
528
536
year ,
537
+ errMsg ,
529
538
}
530
539
tmpl .Execute (w , & data )
531
540
}
@@ -560,7 +569,7 @@ func PubValidatePost(w http.ResponseWriter, r *http.Request) {
560
569
// check if repository is accessible
561
570
repoinfo , err := gcl .GetRepo (repopath )
562
571
if err != nil {
563
- fail (w , http . StatusNotFound , err . Error ( ))
572
+ renderValidationForm (w , r , fmt . Sprintf ( "Repository '%s' does not exist." , repopath ))
564
573
return
565
574
}
566
575
if repoinfo .Private {
0 commit comments