fix: ensure all byte output is trimmed of whitespace

This otherwise causes issues when interpreting the output as part of a variable, such as when constructing the deploying app image.

Closes #4229
This commit is contained in:
Jose Diaz-Gonzalez
2020-12-13 02:04:35 -05:00
parent ca2de6a4a3
commit 8c14bb9aeb
4 changed files with 10 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
package apps
import (
"strings"
"github.com/dokku/dokku/plugins/common"
)
@@ -12,7 +14,7 @@ func ReportSingleApp(appName, infoFlag string) error {
deploySource := ""
if b, err := common.PlugnTriggerSetup("deploy-source", []string{appName}...).SetInput("").Output(); err != nil {
deploySource = string(b[:])
deploySource = strings.TrimSpace(string(b[:]))
}
locked := "false"

View File

@@ -140,7 +140,7 @@ func maybeCreateApp(appName string) error {
}
b, _ := common.PlugnTriggerOutput("config-get-global", []string{"DOKKU_DISABLE_APP_AUTOCREATION"}...)
disableAutocreate := string(b[:])
disableAutocreate := strings.TrimSpace(string(b[:]))
if disableAutocreate == "true" {
common.LogWarn("App auto-creation disabled.")
return fmt.Errorf("Re-enable app auto-creation or create an app with 'dokku apps:create %s'", appName)