Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spelling of separator #2913

Merged
merged 3 commits into from Mar 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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