From 2a6eeb9a42084f1891f58c90a7db17e96e9dd819 Mon Sep 17 00:00:00 2001 From: Howard Wu Date: Wed, 4 Sep 2024 11:24:14 +1200 Subject: [PATCH] feat: add IU/SNZO for querie special case --- cmd/fdsn-ws/fdsn_dataselect.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/fdsn-ws/fdsn_dataselect.go b/cmd/fdsn-ws/fdsn_dataselect.go index 5248937..7ec2cfc 100644 --- a/cmd/fdsn-ws/fdsn_dataselect.go +++ b/cmd/fdsn-ws/fdsn_dataselect.go @@ -186,9 +186,12 @@ func fdsnDataselectV1Handler(r *http.Request, w http.ResponseWriter) (int64, err if !d.End.After(d.Start) { return 0, fdsnError{StatusError: weft.StatusError{Code: http.StatusBadRequest, Err: fmt.Errorf("endtime must be after starttime")}, url: r.URL.String(), timestamp: tm} } - // we only do "NZ" - if m, err := regexp.MatchString(d.Network, "NZ"); err != nil || !m { - continue + // We reject all queries for network not "NZ", except special case IU/SNZO. + // Note: IU/SNZO won't matched by wildcard queries. + if d.Network != "IU" && d.Station != "SNZO" { + if m, err := regexp.MatchString(d.Network, "NZ"); err != nil || !m { + continue + } } // only run query when the pattern contains only uppercase alphabetic, numbers, wildcard chars // if the pattern string is out of this range, we knew it won't produce results