Skip to content

Commit

Permalink
fix parsing dmarc reports that come with content-type application/oct…
Browse files Browse the repository at this point in the history
…et-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.
  • Loading branch information
mjl- committed Nov 4, 2023
1 parent 3a7ed97 commit c955fad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dmarcrpt/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func parseReport(p message.Part) (*Feedback, error) {
r := p.Reader()

// 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)
n, err := io.ReadFull(r, data)
if err == io.EOF {
Expand All @@ -92,7 +92,7 @@ func parseReport(p message.Part) (*Feedback, error) {
case "application/zip":
// Google sends messages with direct application/zip content-type.
return parseZip(r)
case "application/gzip":
case "application/gzip", "application/x-gzip":
gzr, err := gzip.NewReader(r)
if err != nil {
return nil, fmt.Errorf("decoding gzip xml report: %s", err)
Expand Down

0 comments on commit c955fad

Please sign in to comment.