changeset 5380:a4b52a3ae0bd extented-report

Allow dash (`-') in report names.
author wilde@azure1.rgb.intevation.de
date Thu, 24 Jun 2021 16:48:50 +0200
parents 23a330c5b10d
children 80d7e38acaff
files pkg/controllers/routes.go pkg/imports/report.go
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/routes.go	Thu Jun 24 16:43:59 2021 +0200
+++ b/pkg/controllers/routes.go	Thu Jun 24 16:48:50 2021 +0200
@@ -341,7 +341,7 @@
 			NoConn: true,
 		})).Methods(http.MethodGet)
 
-	api.Handle("/data/report/{name:[a-zA-Z0-9_]+}", waterwayAdmin(
+	api.Handle("/data/report/{name:[a-zA-Z0-9_-]+}", waterwayAdmin(
 		mw.DBConn(http.HandlerFunc(report)))).Methods(http.MethodGet)
 
 	// Handler to serve data to the client.
--- a/pkg/imports/report.go	Thu Jun 24 16:43:59 2021 +0200
+++ b/pkg/imports/report.go	Thu Jun 24 16:48:50 2021 +0200
@@ -124,7 +124,7 @@
 	}
 
 	// TODO: Prevent this earlier.
-	if match, _ := regexp.MatchString(`^[a-zA-Z0-9_]+$`, r.Name); !match {
+	if match, _ := regexp.MatchString(`^[a-zA-Z0-9_-]+$`, r.Name); !match {
 		return nil, nil, errors.New("invalid report name")
 	}