Feroze Mohideen 3 lat temu
rodzic
commit
dcc4fc929d

+ 1 - 1
api/server/handlers/stacks/create_porter_app.go

@@ -88,7 +88,7 @@ func (c *CreatePorterAppHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
 		// this is required because when the front-end sends an update request with overrideRelease=true, it is unable to
 		// get the image info from the release. unless it is explicitly provided in the request, we avoid overwriting it
 		// by attempting to get the image info from the release
-		if imageInfo.Repository == "" || imageInfo.Tag == "" {
+		if helmRelease != nil && (imageInfo.Repository == "" || imageInfo.Tag == "") {
 			imageInfo = attemptToGetImageInfoFromRelease(helmRelease.Config)
 		}
 	} else {

+ 16 - 8
api/server/handlers/stacks/parse.go

@@ -454,14 +454,22 @@ func getChartTypeFromHelmName(name string) string {
 
 func attemptToGetImageInfoFromRelease(values map[string]interface{}) types.ImageInfo {
 	imageInfo := types.ImageInfo{}
-	if imageVal, ok := values["global"].(map[string]interface{})["image"]; ok {
-		imageMap := imageVal.(map[string]interface{})
-		if repo, ok := imageMap["repository"]; ok {
-			imageInfo.Repository = repo.(string)
-		}
-		if tag, ok := imageMap["tag"]; ok {
-			imageInfo.Tag = tag.(string)
-		}
+
+	if values == nil {
+		return imageInfo
 	}
+
+	globalImage, err := getNestedMap(values, "global", "image")
+	if err != nil {
+		return imageInfo
+	}
+
+	repoVal, okRepo := globalImage["repository"]
+	tagVal, okTag := globalImage["tag"]
+	if okRepo && okTag {
+		imageInfo.Repository = repoVal.(string)
+		imageInfo.Tag = tagVal.(string)
+	}
+
 	return imageInfo
 }

+ 1 - 1
dashboard/src/components/DynamicLink.tsx

@@ -1,7 +1,7 @@
 import React from "react";
 import { Link, LinkProps } from "react-router-dom";
 
-const DynamicLink: React.FC<LinkProps> = ({ to, children, ...props }) => {
+const DynamicLink: React.FC<LinkProps> = ({ to, children, hasunderline, ...props }) => {
   // It is a simple element with nothing to link to
   if (!to) return <span {...props}>{children}</span>;