| OLD | NEW |
| 1 package frontend | 1 package frontend |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "bytes" | 4 "bytes" |
| 5 "encoding/json" | 5 "encoding/json" |
| 6 "io" | 6 "io" |
| 7 "net/http" | 7 "net/http" |
| 8 "regexp" | 8 "regexp" |
| 9 "sort" | 9 "sort" |
| 10 "strings" | 10 "strings" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 case nil: | 99 case nil: |
| 100 res = item.Value() | 100 res = item.Value() |
| 101 | 101 |
| 102 default: | 102 default: |
| 103 logging.WithError(err).Errorf(c, "builders: GetBuilders") | 103 logging.WithError(err).Errorf(c, "builders: GetBuilders") |
| 104 http.Error(w, err.Error(), http.StatusInternalServerError) | 104 http.Error(w, err.Error(), http.StatusInternalServerError) |
| 105 return | 105 return |
| 106 } | 106 } |
| 107 | 107 |
| 108 var out io.Reader = bytes.NewReader(res) | 108 var out io.Reader = bytes.NewReader(res) |
| 109 » if callback := r.FormValue("callback"); callback != "" { | 109 » if c := r.FormValue("callback"); callbackNameRx.MatchString(c) { |
| 110 » » out = wrapCallback(out, callback) | 110 » » out = wrapCallback(out, c) |
| 111 } | 111 } |
| 112 | 112 |
| 113 n, err := io.Copy(w, out) | 113 n, err := io.Copy(w, out) |
| 114 | 114 |
| 115 if err != nil { | 115 if err != nil { |
| 116 logging.Fields{ | 116 logging.Fields{ |
| 117 logging.ErrorKey: err, | 117 logging.ErrorKey: err, |
| 118 "n": n, | 118 "n": n, |
| 119 }.Errorf(c, "builders: GetBuilders: failed to write response") | 119 }.Errorf(c, "builders: GetBuilders: failed to write response") |
| 120 } | 120 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // data, we just keep everything before the first space. | 382 // data, we just keep everything before the first space. |
| 383 if i := strings.Index(name, " "); i != -1 { | 383 if i := strings.Index(name, " "); i != -1 { |
| 384 name = name[:i] | 384 name = name[:i] |
| 385 } | 385 } |
| 386 | 386 |
| 387 if withPatch { | 387 if withPatch { |
| 388 name += " (with patch)" | 388 name += " (with patch)" |
| 389 } | 389 } |
| 390 return name | 390 return name |
| 391 } | 391 } |
| OLD | NEW |