File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ func (s *Server) Reload(cfg srvCfg.Config) {
187187
188188// InitHandlers initializes handler functions of the HTTP server.
189189func (s * Server ) InitHandlers () {
190- r := mux .NewRouter ().StrictSlash (true )
190+ r := mux .NewRouter ().StrictSlash (true ). UseEncodedPath ()
191191
192192 authMW := mw .NewAuth (s .Config .VerificationToken , s .Platform )
193193
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package validator
77
88import (
99 "fmt"
10+ "strings"
1011
1112 "github.com/pkg/errors"
1213 passwordvalidator "github.com/wagslane/go-password-validator"
@@ -34,6 +35,10 @@ func (v Service) ValidateCloneRequest(cloneRequest *types.CloneCreateRequest) er
3435 return errors .New ("missing DB password" )
3536 }
3637
38+ if cloneRequest .ID != "" && strings .Contains (cloneRequest .ID , "/" ) {
39+ return errors .New ("Clone ID cannot contain slash ('/'). Please choose another ID" )
40+ }
41+
3742 if err := passwordvalidator .Validate (cloneRequest .DB .Password , minEntropyBits ); err != nil {
3843 return fmt .Errorf ("password validation: %w" , err )
3944 }
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ func TestValidationCloneRequestErrors(t *testing.T) {
5555 createRequest : types.CloneCreateRequest {DB : & types.DatabaseRequest {Password : "password" }},
5656 error : "missing DB username" ,
5757 },
58+ {
59+ createRequest : types.CloneCreateRequest {
60+ DB : & types.DatabaseRequest {Username : "user" , Password : "password" },
61+ ID : "test/ID" ,
62+ },
63+ error : "Clone ID cannot contain slash ('/'). Please choose another ID" ,
64+ },
5865 }
5966
6067 for _ , tc := range testCases {
You can’t perform that action at this time.
0 commit comments