Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions pkg/splunk/enterprise/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,21 +1243,14 @@ func handleAppRepoChanges(ctx context.Context, client splcommon.ControllerClient

// isAppExtentionValid checks if an app extention is supported or not
func isAppExtentionValid(receivedKey string) bool {
appExtIdx := strings.LastIndex(receivedKey, ".")
if appExtIdx < 0 {
return false
}

switch appExt := receivedKey[appExtIdx+1:]; appExt {
case "spl":
return true

case "tgz":
return true
validExtensions := []string{".spl", ".tgz", ".tar.gz"}

default:
return false
for _, ext := range validExtensions {
if strings.HasSuffix(receivedKey, ext) {
return true
}
}
return false
}

// AddOrUpdateAppSrcDeploymentInfoList modifies the App deployment status as perceived from the remote object listing
Expand Down
2 changes: 1 addition & 1 deletion pkg/splunk/enterprise/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ func TestGetAvailableDiskSpaceShouldFail(t *testing.T) {
}

func TestIsAppExtentionValid(t *testing.T) {
if !isAppExtentionValid("testapp.spl") || !isAppExtentionValid("testapp.tgz") {
if !isAppExtentionValid("testapp.spl") || !isAppExtentionValid("testapp.tgz") || !isAppExtentionValid("testapp.tar.gz") {
t.Errorf("failed to detect valid app extension")
}

Expand Down
Loading