Skip to content

Commit

Permalink
Merge branch 'master' into go-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
leecalcote committed Dec 18, 2024
2 parents 10e6bd1 + 89d97c9 commit e8e4cff
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions models/registration/svg_helper.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package registration

import (
"crypto/md5"
"encoding/hex"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit e8e4cff

Please sign in to comment.