@@ -12,6 +12,7 @@ import (
1212
1313// CompressImage resizes and compresses an image for sending
1414func CompressImage (path string , maxWidth , maxHeight uint ) ([]byte , string , int , int , error ) {
15+ // #nosec G304
1516 file , err := os .Open (path )
1617 if err != nil {
1718 return nil , "" , 0 , 0 , err
@@ -43,17 +44,12 @@ func CompressImage(path string, maxWidth, maxHeight uint) ([]byte, string, int,
4344 return nil , "" , 0 , 0 , err
4445 }
4546
46- // Convert original png to jpeg for consistency/compression if desired?
47- // Or keep png if transparency matters?
48- // User said "compress to not weigh much". JPEG is best for photos.
49- // If original was PNG with transparency, JPEG turns transparency to black.
50- // Let's stick to JPEG for general photos. If raw, we use raw file.
51-
5247 return buf .Bytes (), mimeType , width , height , nil
5348}
5449
5550// GetImageDimensions returns width and height of an image file
5651func GetImageDimensions (path string ) (int , int , error ) {
52+ // #nosec G304
5753 file , err := os .Open (path )
5854 if err != nil {
5955 return 0 , 0 , err
0 commit comments