Skip to content

Commit

Permalink
Fix spelling of separator(dapr#2912) (dapr#2913)
Browse files Browse the repository at this point in the history
Co-authored-by: wenjing.dgh <wenjing.dgh@taobao.com>
Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
  • Loading branch information
3 people authored and daheige committed Apr 13, 2021
1 parent 9d7c6c2 commit 4885cbc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/scopes/scopes.go
Expand Up @@ -8,9 +8,9 @@ const (
SubscriptionScopes = "subscriptionScopes"
PublishingScopes = "publishingScopes"
AllowedTopics = "allowedTopics"
appsSeperator = ";"
appSeperator = "="
topicSeperator = ","
appsSeparator = ";"
appSeparator = "="
topicSeparator = ","
)

// GetScopedTopics returns a list of scoped topics for a given application from a Pub/Sub
Expand All @@ -23,9 +23,9 @@ func GetScopedTopics(scope, appID string, metadata map[string]string) []string {

if val, ok := metadata[scope]; ok && val != "" {
val = strings.ReplaceAll(val, " ", "")
apps := strings.Split(val, appsSeperator)
apps := strings.Split(val, appsSeparator)
for _, a := range apps {
appTopics := strings.Split(a, appSeperator)
appTopics := strings.Split(a, appSeparator)
if len(appTopics) == 0 {
continue
}
Expand All @@ -35,7 +35,7 @@ func GetScopedTopics(scope, appID string, metadata map[string]string) []string {
continue
}

tempTopics := strings.Split(appTopics[1], topicSeperator)
tempTopics := strings.Split(appTopics[1], topicSeparator)
for _, tempTopic := range tempTopics {
if _, ok = existM[tempTopic]; !ok {
existM[tempTopic] = struct{}{}
Expand All @@ -47,7 +47,7 @@ func GetScopedTopics(scope, appID string, metadata map[string]string) []string {
return topics
}

// GetAllowdTopics return the all topics list of params allowdTopics
// GetAllowedTopics return the all topics list of params allowedTopics
func GetAllowedTopics(metadata map[string]string) []string {
var (
existM = map[string]struct{}{}
Expand All @@ -56,7 +56,7 @@ func GetAllowedTopics(metadata map[string]string) []string {

if val, ok := metadata[AllowedTopics]; ok && val != "" {
val = strings.ReplaceAll(val, " ", "")
tempTopics := strings.Split(val, topicSeperator)
tempTopics := strings.Split(val, topicSeparator)
for _, tempTopic := range tempTopics {
if _, ok = existM[tempTopic]; !ok {
existM[tempTopic] = struct{}{}
Expand Down

0 comments on commit 4885cbc

Please sign in to comment.