azure storage queue fix double quotation (#1156)

* azure storage queue fix double quotation

* Trigger checks

* Trigger checks

Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
This commit is contained in:
Javier Vela 2021-10-07 22:54:20 +02:00 committed by GitHub
parent 3f6c2e867c
commit 32bba35bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -13,7 +13,7 @@ import (
"net/url"
"os"
"os/signal"
"strings"
"strconv"
"sync"
"syscall"
"time"
@ -77,13 +77,17 @@ func (d *AzureQueueHelper) Init(accountName string, accountKey string, queueName
func (d *AzureQueueHelper) Write(data []byte, ttl *time.Duration) error {
ctx := context.TODO()
messagesURL := d.queueURL.NewMessagesURL()
s := string(data)
s, err := strconv.Unquote(string(data))
if err != nil {
s = string(data)
}
if ttl == nil {
ttlToUse := defaultTTL
ttl = &ttlToUse
}
_, err := messagesURL.Enqueue(ctx, s, time.Second*0, *ttl)
_, err = messagesURL.Enqueue(ctx, s, time.Second*0, *ttl)
return err
}
@ -105,7 +109,7 @@ func (d *AzureQueueHelper) Read(ctx context.Context, consumer *consumer) error {
var data []byte
if d.decodeBase64 {
decoded, decodeError := base64.StdEncoding.DecodeString(strings.Trim(mt, "\""))
decoded, decodeError := base64.StdEncoding.DecodeString(mt)
if decodeError != nil {
return decodeError
}