mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
fix parsing dmarc reports that come with content-type application/octet-stream
by fixing a typo in the content-type... and by recognizing the application/x-zip that is detected as content-type. discovered when a dmarc report from aws ses wasn't processed. it seems aws ses was sending a dmarc report because it received a dmarc report.
This commit is contained in:
parent
3a7ed9738a
commit
c955fadb6d
1 changed files with 2 additions and 2 deletions
|
@ -75,7 +75,7 @@ func parseReport(p message.Part) (*Feedback, error) {
|
||||||
r := p.Reader()
|
r := p.Reader()
|
||||||
|
|
||||||
// If no (useful) content-type is set, try to detect it.
|
// If no (useful) content-type is set, try to detect it.
|
||||||
if ct == "" || ct == "application/octect-stream" {
|
if ct == "" || ct == "application/octet-stream" {
|
||||||
data := make([]byte, 512)
|
data := make([]byte, 512)
|
||||||
n, err := io.ReadFull(r, data)
|
n, err := io.ReadFull(r, data)
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
|
@ -92,7 +92,7 @@ func parseReport(p message.Part) (*Feedback, error) {
|
||||||
case "application/zip":
|
case "application/zip":
|
||||||
// Google sends messages with direct application/zip content-type.
|
// Google sends messages with direct application/zip content-type.
|
||||||
return parseZip(r)
|
return parseZip(r)
|
||||||
case "application/gzip":
|
case "application/gzip", "application/x-gzip":
|
||||||
gzr, err := gzip.NewReader(r)
|
gzr, err := gzip.NewReader(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("decoding gzip xml report: %s", err)
|
return nil, fmt.Errorf("decoding gzip xml report: %s", err)
|
||||||
|
|
Loading…
Reference in a new issue