Review comments

Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
Matthias Hanel
2021-07-22 11:25:56 -04:00
parent ddd665b036
commit 06ac80cdbe
2 changed files with 6 additions and 5 deletions

View File

@@ -3346,7 +3346,7 @@ func TestImportSubscriptionPartialOverlapWithPrefix(t *testing.T) {
}
func TestImportSubscriptionPartialOverlapWithTransform(t *testing.T) {
cf := createConfFile(t, []byte(fmt.Sprintf(importSubscriptionOverlapTemplate, "*.*.>", "*.*.>", " to: myprefix.$2.$1.>")))
cf := createConfFile(t, []byte(fmt.Sprintf(importSubscriptionOverlapTemplate, "*.*.>", "*.*.>", "to: myprefix.$2.$1.>")))
defer removeFile(t, cf)
s, opts := RunServerWithConfig(cf)

View File

@@ -2509,9 +2509,10 @@ func (c *client) addShadowSubscriptions(acc *Account, sub *subscription) error {
for _, tk := range tokens {
if tk == pwcs {
hasWC = true
break
}
}
if tokens[len(tokens)-1] == fwcs {
if !hasWC && tokens[len(tokens)-1] == fwcs {
hasWC = true
}
}
@@ -2524,7 +2525,7 @@ func (c *client) addShadowSubscriptions(acc *Account, sub *subscription) error {
continue
}
if subj == im.to {
ims = append(ims, ime{im, "", false})
ims = append(ims, ime{im, _EMPTY_, false})
continue
}
if tokensModified {
@@ -2537,10 +2538,10 @@ func (c *client) addShadowSubscriptions(acc *Account, sub *subscription) error {
tokenizeSubjectIntoSlice(im.to, &imTokens)
if isSubsetMatchTokenized(tokens, imTokens) {
ims = append(ims, ime{im, "", true})
ims = append(ims, ime{im, _EMPTY_, true})
} else if hasWC {
if isSubsetMatchTokenized(imTokens, tokens) {
ims = append(ims, ime{im, "", false})
ims = append(ims, ime{im, _EMPTY_, false})
} else {
imTokensLen := len(imTokens)
for i, t := range tokens {