mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Merge pull request #2237 from nats-io/error-on-bad-api-prefix
[fixed] issue with invalid api prefix for source/mirror
This commit is contained in:
@@ -1291,7 +1291,7 @@ func (s *Server) jsStreamCreateRequest(sub *subscription, c *client, subject, re
|
||||
// check prefix overlap with subjects
|
||||
for _, pfx := range deliveryPrefixes {
|
||||
if !IsValidPublishSubject(pfx) {
|
||||
resp.Error = &ApiError{Code: 400, Description: fmt.Sprintf("stream external delivery prefix %q must not contain wildcards", pfx)}
|
||||
resp.Error = &ApiError{Code: 400, Description: fmt.Sprintf("stream external delivery prefix %q must be a valid subject without wildcards", pfx)}
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
@@ -1305,6 +1305,11 @@ func (s *Server) jsStreamCreateRequest(sub *subscription, c *client, subject, re
|
||||
}
|
||||
// check if api prefixes overlap
|
||||
for _, apiPfx := range apiPrefixes {
|
||||
if !IsValidPublishSubject(apiPfx) {
|
||||
resp.Error = &ApiError{Code: 400, Description: fmt.Sprintf("stream external api prefix %q must be a valid subject without wildcards", apiPfx)}
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
return
|
||||
}
|
||||
if SubjectsCollide(apiPfx, JSApiPrefix) {
|
||||
resp.Error = &ApiError{Code: 400, Description: fmt.Sprintf("stream external api prefix %q must not overlap with %s", apiPfx, JSApiPrefix)}
|
||||
s.sendAPIErrResponse(ci, acc, subject, reply, string(msg), s.jsonResponse(&resp))
|
||||
|
||||
Reference in New Issue
Block a user