Adding Filters for Filetypes to prevent Printing of invalid Files.

This commit is contained in:
itsscb 2022-08-14 12:00:44 +02:00
parent d8d26a29a7
commit a63d6ef7f0

View File

@ -343,7 +343,7 @@ func (m *Monitor) PrintAll() error {
tfp = fp + ".html"
} else if strings.Contains(ct, "text/plain") {
tfp = fp + ".txt"
} else {
} else if strings.Contains(ct, "application/pdf") || strings.Contains(ct, "image") {
filename := strings.Split(
strings.Split(ct, ";")[1],
"=")[1]
@ -351,7 +351,17 @@ func (m *Monitor) PrintAll() error {
}
case *mail.AttachmentHeader:
filename, _ := h.Filename()
var filename string
if strings.Contains(ct, "text/html") {
tfp = fp + ".html"
} else if strings.Contains(ct, "text/plain") {
tfp = fp + ".txt"
} else if strings.Contains(ct, "application/pdf") || strings.Contains(ct, "image") {
filename, _ = h.Filename()
tfp = fp + filename
} else {
continue
}
tfp = fp + filename
}