Skip to content

Commit 016fc05

Browse files
committed
Replacing + with %20 in URL query strings
1 parent 78f7287 commit 016fc05

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cmd/lhsm-plugin-az-core/remove.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"net/url"
77
"path"
8+
"strings"
89

910
"github.com/Azure/azure-pipeline-go/pipeline"
1011
"github.com/Azure/azure-storage-blob-go/azblob"
@@ -24,7 +25,7 @@ type RemoveOptions struct {
2425
func Remove(o RemoveOptions) error {
2526
ctx := context.TODO()
2627
p := azblob.NewPipeline(o.Credential, azblob.PipelineOptions{})
27-
blobPath := url.QueryEscape(path.Join(o.ContainerName, o.ExportPrefix, o.BlobName))
28+
blobPath := strings.Replace(url.QueryEscape(path.Join(o.ContainerName, o.ExportPrefix, o.BlobName)), "+", "%20", -1)
2829
u, _ := url.Parse(fmt.Sprintf("https://%s.%s/%s%s", o.AccountName, o.AccountSuffix, blobPath, o.ResourceSAS))
2930

3031
util.Log(pipeline.LogInfo, fmt.Sprintf("Removing %s.", u.String()))

cmd/lhsm-plugin-az-core/restore.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/url"
88
"os"
99
"path"
10+
"strings"
1011

1112
"github.com/Azure/azure-pipeline-go/pipeline"
1213
"github.com/Azure/azure-storage-blob-go/azblob"
@@ -39,7 +40,7 @@ func Restore(o RestoreOptions) (int64, error) {
3940
defer cancel()
4041

4142
p := util.NewPipeline(ctx, o.Credential, o.Pacer, azblob.PipelineOptions{HTTPSender: util.HTTPClientFactory(o.HTTPClient)})
42-
blobPath := url.QueryEscape(path.Join(o.ContainerName, o.ExportPrefix, o.BlobName))
43+
blobPath := strings.Replace(url.QueryEscape(path.Join(o.ContainerName, o.ExportPrefix, o.BlobName)), "+", "%20", -1)
4344

4445
u, _ := url.Parse(fmt.Sprintf("https://%s.%s/%s%s", o.AccountName, o.AccountSuffix, blobPath, o.ResourceSAS))
4546

0 commit comments

Comments
 (0)