diff --git a/CHANGELOG.md b/CHANGELOG.md index d72d239bb2b..be486db7c18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ ### Improvements -- TODO ([#XXX](https://github.com/kedacore/keda/pull/XXX)) +- Support listing blobs recursively in azure-blob scaler ([#1789](https://github.com/kedacore/keda/issues/1789)) ### Breaking Changes diff --git a/pkg/scalers/azure_blob_scaler.go b/pkg/scalers/azure_blob_scaler.go index ab3bbfefd16..a79b028a037 100644 --- a/pkg/scalers/azure_blob_scaler.go +++ b/pkg/scalers/azure_blob_scaler.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "strconv" + "strings" "github.com/kedacore/keda/v2/pkg/scalers/azure" @@ -81,12 +82,13 @@ func parseAzureBlobMetadata(config *ScalerConfig) (*azureBlobMetadata, kedav1alp return nil, "", fmt.Errorf("no blobContainerName given") } - if val, ok := config.TriggerMetadata["blobDelimiter"]; ok && val != "" { - meta.blobDelimiter = val - } + meta.blobDelimiter = config.TriggerMetadata["blobDelimiter"] if val, ok := config.TriggerMetadata["blobPrefix"]; ok && val != "" { - meta.blobPrefix = val + meta.blobDelimiter + meta.blobPrefix = val + if !strings.HasSuffix(meta.blobPrefix, defaultBlobDelimiter) { + meta.blobPrefix += defaultBlobDelimiter + } } endpointSuffix, err := azure.ParseAzureStorageEndpointSuffix(config.TriggerMetadata, azure.BlobEndpoint)