Skip to content

Commit

Permalink
Use inttp prefix in detect.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jhillyerd committed Aug 22, 2023
1 parent e23f12b commit a5c8cee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions detect.go
Expand Up @@ -3,7 +3,7 @@ package enmime
import (
"strings"

"github.com/jhillyerd/enmime/internal/textproto"
inttp "github.com/jhillyerd/enmime/internal/textproto"
"github.com/jhillyerd/enmime/mediatype"
)

Expand Down Expand Up @@ -35,7 +35,7 @@ func detectMultipartMessage(root *Part, multipartWOBoundaryAsSinglepart bool) bo
// - Content-Disposition: attachment; filename="frog.jpg"
// - Content-Disposition: inline; filename="frog.jpg"
// - Content-Type: attachment; filename="frog.jpg"
func detectAttachmentHeader(header textproto.MIMEHeader) bool {
func detectAttachmentHeader(header inttp.MIMEHeader) bool {
mtype, params, _, _ := mediatype.Parse(header.Get(hnContentDisposition))
if strings.ToLower(mtype) == cdAttachment ||
(strings.ToLower(mtype) == cdInline && len(params) > 0) {
Expand All @@ -49,7 +49,7 @@ func detectAttachmentHeader(header textproto.MIMEHeader) bool {
// detectTextHeader returns true, if the the MIME headers define a valid 'text/plain' or 'text/html'
// part. If the emptyContentTypeIsPlain argument is set to true, a missing Content-Type header will
// result in a positive plain part detection.
func detectTextHeader(header textproto.MIMEHeader, emptyContentTypeIsText bool) bool {
func detectTextHeader(header inttp.MIMEHeader, emptyContentTypeIsText bool) bool {
ctype := header.Get(hnContentType)
if ctype == "" && emptyContentTypeIsText {
return true
Expand All @@ -67,7 +67,7 @@ func detectTextHeader(header textproto.MIMEHeader, emptyContentTypeIsText bool)

// detectBinaryBody returns true if the mail header defines a binary body.
func detectBinaryBody(root *Part) bool {
header := textproto.MIMEHeader(root.Header) // Use internal header methods.
header := inttp.MIMEHeader(root.Header) // Use internal header methods.
if detectTextHeader(header, true) {
// It is text/plain, but an attachment.
// Content-Type: text/plain; name="test.csv"
Expand Down

0 comments on commit a5c8cee

Please sign in to comment.