paths safeguard
This commit is contained in:
3
blend.go
3
blend.go
@ -8,6 +8,7 @@ import (
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// convert RGBA pixel to grayscale. BT.709 luminosity formula
|
||||
@ -115,7 +116,7 @@ func blendColor(color1 color.Color, color2 color.Color) color.Color {
|
||||
|
||||
// encode the image
|
||||
func encodeImage(imgData *image.RGBA) {
|
||||
outputFile := fmt.Sprintf("%s/%s", ConfigRegister.OutputDir, "output.jpg")
|
||||
outputFile := fmt.Sprintf("%s/%s", path.Clean(ConfigRegister.OutputDir), "output.jpg")
|
||||
out, _ := os.Create(outputFile)
|
||||
defer out.Close()
|
||||
log.Println("Encoding the new image...")
|
||||
|
||||
Reference in New Issue
Block a user