fix: sanitize app.json in trigger

This commit is contained in:
Jose Diaz-Gonzalez committed 2025-11-20 00:35:17 -05:00
1 parent 38505006e8
commit 421863f4ac
1 file changed
+7 -8
+7 -8
View File
@@ -1,9 +1,9 @@
package appjson package appjson
import ( import (
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"os"
"strings" "strings"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
@@ -42,18 +42,17 @@ func TriggerAppJSONGetContent(appName string) error {
return nil return nil
} }
b, err := os.ReadFile(getProcessSpecificAppJSONPath(appName)) appJSON, err := ReadAppJSON(getProcessSpecificAppJSONPath(appName))
if err != nil { if err != nil {
return fmt.Errorf("Cannot read app.json file: %v", err) return err
} }
content := strings.TrimSpace(string(b)) content, err := json.Marshal(appJSON)
if content == "" { if err != nil {
fmt.Print("{}") return err
return nil
} }
fmt.Print(content) fmt.Print(string(content))
return nil return nil
} }