File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,15 @@ func (r *Redirector) redirectHandler(w http.ResponseWriter, req *http.Request) {
5353
5454 // If the path has a prefix of region/NA, it will use specific regions instead
5555 // of the default geographical distance
56- if strings .HasPrefix (req .URL .Path , "/region" ) {
56+ if strings .HasPrefix (req .URL .Path , "/region/ " ) {
5757 parts := strings .Split (req .URL .Path , "/" )
58+ if len (parts ) < 3 || parts [2 ] == "" {
59+ http .Error (w , "Region not specified" , http .StatusBadRequest )
60+ return
61+ }
5862
59- // region = parts[2]
60- if mirrors , ok := r .regionMap [parts [ 2 ] ]; ok {
63+ region : = parts [2 ]
64+ if mirrors , ok := r .regionMap [region ]; ok {
6165 choices := make ([]randutil.Choice , len (mirrors ))
6266
6367 for i , item := range mirrors {
You can’t perform that action at this time.
0 commit comments