Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
fix: allow for gzip and b64 encoding for raw Addon data by decoding t…
Browse files Browse the repository at this point in the history
…he input beforehand
  • Loading branch information
tariqibrahim committed Feb 22, 2019
1 parent ede4aa6 commit 6124605
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,11 @@ func getBase64CustomScript(csFilename string) string {
return getBase64CustomScriptFromStr(csStr)
}

func getStringFromBase64(str string) (string, error) {
decodedBytes, err := base64.StdEncoding.DecodeString(str)
return string(decodedBytes), err
}

// getBase64CustomScript will return a base64 of the CSE
func getBase64CustomScriptFromStr(str string) string {
var gzipB bytes.Buffer
Expand Down Expand Up @@ -719,7 +724,11 @@ func getContainerAddonsString(properties *api.Properties, sourcePath string) str
if setting.isEnabled {
var input string
if setting.rawScript != "" {
input = setting.rawScript
var err error
input, err = getStringFromBase64(setting.rawScript)
if err != nil {
return ""
}
} else {
orchProfile := properties.OrchestratorProfile
versions := strings.Split(orchProfile.OrchestratorVersion, ".")
Expand Down

0 comments on commit 6124605

Please sign in to comment.