From d1b1cccc3102df201fffb21652327792410ddd94 Mon Sep 17 00:00:00 2001 From: aabidsofi19 Date: Wed, 18 Dec 2024 15:36:05 +0530 Subject: [PATCH] remove asset deduplication for component/model svgs Signed-off-by: aabidsofi19 --- models/registration/svg_helper.go | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/models/registration/svg_helper.go b/models/registration/svg_helper.go index 351d22ee..362ce93c 100644 --- a/models/registration/svg_helper.go +++ b/models/registration/svg_helper.go @@ -1,8 +1,6 @@ package registration import ( - "crypto/md5" - "encoding/hex" "fmt" "os" "path/filepath" @@ -37,13 +35,7 @@ func WriteAndReplaceSVGWithFileSystemPath(svgColor, svgWhite, svgComplete string } successCreatingDirectory = true - hash := md5.Sum([]byte(svgColor)) - hashString := hex.EncodeToString(hash[:]) - pathsvg := hashCheckSVG[hashString] - if pathsvg != "" && !isModel { // the image has already been loaded, point the component to that path - svgColorPath = pathsvg - goto White - } + f, err := os.Create(filepath.Join(path, filename+"-color.svg")) if err != nil { fmt.Println(err) @@ -55,10 +47,8 @@ func WriteAndReplaceSVGWithFileSystemPath(svgColor, svgWhite, svgComplete string return } svgColorPath = getRelativePathForAPI(baseDir, filepath.Join(dirname, "color", filename+"-color.svg")) //Replace the actual SVG with path to SVG - writeHashCheckSVG(hashString, svgColorPath) } -White: if svgWhite != "" { path := filepath.Join(baseDir, dirname, "white") err := os.MkdirAll(path, 0777) @@ -68,13 +58,7 @@ White: } successCreatingDirectory = true - hash := md5.Sum([]byte(svgWhite)) - hashString := hex.EncodeToString(hash[:]) - pathsvg := hashCheckSVG[hashString] - if pathsvg != "" && !isModel { // the image has already been loaded, point the component to that path - svgWhitePath = pathsvg - goto Complete - } + f, err := os.Create(filepath.Join(path, filename+"-white.svg")) if err != nil { fmt.Println(err) @@ -86,10 +70,8 @@ White: return } svgWhitePath = getRelativePathForAPI(baseDir, filepath.Join(dirname, "white", filename+"-white.svg")) //Replace the actual SVG with path to SVG - writeHashCheckSVG(hashString, svgWhitePath) } -Complete: if svgComplete != "" { path := filepath.Join(baseDir, dirname, "complete") err := os.MkdirAll(path, 0777) @@ -99,13 +81,6 @@ Complete: } successCreatingDirectory = true - hash := md5.Sum([]byte(svgComplete)) - hashString := hex.EncodeToString(hash[:]) - pathsvg := hashCheckSVG[hashString] - if pathsvg != "" && !isModel { // the image has already been loaded, point the component to that path - svgCompletePath = pathsvg - return - } f, err := os.Create(filepath.Join(path, filename+"-complete.svg")) if err != nil { fmt.Println(err) @@ -117,7 +92,6 @@ Complete: return } svgCompletePath = getRelativePathForAPI(baseDir, filepath.Join(dirname, "complete", filename+"-complete.svg")) //Replace the actual SVG with path to SVG - writeHashCheckSVG(hashString, svgCompletePath) } return