support subjects starting with {

still doesnt support a subject {}

Signed-off-by: R.I.Pienaar <rip@devco.net>
This commit is contained in:
R.I.Pienaar
2020-11-17 16:33:22 +01:00
parent 02eaf6d831
commit ca8cbcdc63
2 changed files with 9 additions and 6 deletions

View File

@@ -997,13 +997,11 @@ func (s *Server) jsStreamLookupRequest(sub *subscription, c *client, subject, re
if bytes.HasPrefix(bytes.TrimSpace(msg), []byte("{")) {
var req JSApiStreamLookupRequest
err := json.Unmarshal(msg, &req)
if err != nil {
resp.Error = &ApiError{Code: 400, Description: "invalid request"}
s.sendAPIResponse(c, subject, reply, string(msg), s.jsonResponse(&resp))
return
// happy path we set it, otherwise we try whatever was in the
// msg as if its a subject this is because '{' is a valid subject
if err == nil {
subj = req.Subject
}
subj = req.Subject
}
if !IsValidSubject(subj) {