Skip to content

Commit

Permalink
fix(backupbackingimage): encode URL for NFS backup target with options
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 9702

Signed-off-by: James Lu <[email protected]>
  • Loading branch information
mantissahz committed Oct 24, 2024
1 parent ef7b22d commit c988d4f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backupbackingimage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net/url"
"path/filepath"
"strings"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -117,7 +118,11 @@ func getBackingImageBlockPath() string {
func EncodeBackupBackingImageURL(backingImageName, destURL string) string {
v := url.Values{}
v.Add("backingImage", backingImageName)
return destURL + "?" + v.Encode()
prefixChar := "?"
if strings.Contains(destURL, "?") {
prefixChar = "&"
}
return destURL + prefixChar + v.Encode()

Check warning on line 125 in backupbackingimage/config.go

View check run for this annotation

Codecov / codecov/patch

backupbackingimage/config.go#L121-L125

Added lines #L121 - L125 were not covered by tests
}

func DecodeBackupBackingImageURL(backupURL string) (string, string, error) {
Expand Down

0 comments on commit c988d4f

Please sign in to comment.