forked from tcp.direct/tcp.ac
don't try to scrub gif exif data
This commit is contained in:
parent
5c43ec2fc8
commit
5372cfd726
17
error.log
17
error.log
|
@ -1,17 +0,0 @@
|
|||
2020/12/14 07:18:47 main.go:26: 127.0.0.1: 404
|
||||
2020/12/14 07:18:48 main.go:26: 127.0.0.1: 404
|
||||
2020/12/14 07:18:51 main.go:26: 127.0.0.1: 404
|
||||
2020/12/14 07:21:36 main.go:26: 127.0.0.1: error: value too large
|
||||
2020/12/14 07:22:20 main.go:26: 127.0.0.1: error: value too large
|
||||
2020/12/14 07:49:32 main.go:26: 127.0.0.1: http: no such file
|
||||
2020/12/14 07:49:48 main.go:26: 127.0.0.1: http: no such file
|
||||
2020/12/14 07:49:58 main.go:26: 127.0.0.1: http: no such file
|
||||
2020/12/14 07:52:11 main.go:26: 127.0.0.1: 400
|
||||
2020/12/14 07:54:38 main.go:26: 127.0.0.1: 404
|
||||
2020/12/14 07:56:57 main.go:26: 127.0.0.1: 404
|
||||
2020/12/15 23:53:24 main.go:30: 127.0.0.1: 404
|
||||
2020/12/16 00:50:35 main.go:30: ::1: 400
|
||||
2020/12/16 00:50:49 main.go:30: ::1: 400
|
||||
2020/12/16 00:52:26 main.go:30: ::1: 400
|
||||
2020/12/16 00:55:58 main.go:31: 127.0.0.1: bad request
|
||||
2020/12/16 00:56:00 main.go:31: 127.0.0.1: bad request
|
18
main.go
18
main.go
|
@ -62,6 +62,8 @@ func imgView(c *gin.Context) {
|
|||
|
||||
|
||||
func imgPost(c *gin.Context) {
|
||||
var Scrubbed []byte
|
||||
|
||||
f, err := c.FormFile("upload")
|
||||
if err != nil {
|
||||
errThrow(c, http.StatusBadRequest, err.Error(), "no file detected within request")
|
||||
|
@ -84,12 +86,18 @@ func imgPost(c *gin.Context) {
|
|||
fmt.Println("[imgPost] generating uid")
|
||||
uid := gouid.String(5)
|
||||
|
||||
fmt.Println("[imgPost][" + uid + "] dumping byte form of file and scrubbing exif")
|
||||
fmt.Println("[imgPost][" + uid + "] dumping byte form of file")
|
||||
fbytes, err := ioutil.ReadAll(file)
|
||||
Scrubbed, err := exifremove.Remove(fbytes)
|
||||
if err != nil {
|
||||
errThrow(c, http.StatusInternalServerError, err.Error(), "error scrubbing exif")
|
||||
return
|
||||
if imageFormat != "gif" {
|
||||
fmt.Println("[imgPost][" + uid + "] scrubbing exif")
|
||||
Scrubbed, err = exifremove.Remove(fbytes)
|
||||
if err != nil {
|
||||
errThrow(c, http.StatusInternalServerError, err.Error(), "error scrubbing exif")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
fmt.Println("[imgPost][" + uid + "] skipping exif scrub for gif image")
|
||||
Scrubbed = fbytes
|
||||
}
|
||||
|
||||
fmt.Println("[imgPost][" + uid + "] calculating MD5 hash")
|
||||
|
|
Loading…
Reference in New Issue