Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/mail: missing error for unsupported charset #6807

Closed
tgulacsi opened this issue Nov 21, 2013 · 7 comments
Closed

net/mail: missing error for unsupported charset #6807

tgulacsi opened this issue Nov 21, 2013 · 7 comments
Milestone

Comments

@tgulacsi
Copy link
Contributor

What steps will reproduce the problem?
http://play.golang.org/p/u5jfNgQH4Z

What is the expected output?
error parsing "=?iso-8859-2?Q?Bogl=E1rka_Tak=E1cs?=
<unknown@gmail.com>": mail: missing word in phrase (mail: charset not
supported: "iso-8859-2")

What do you see instead?
error parsing "=?iso-8859-2?Q?Bogl=E1rka_Tak=E1cs?=
<unknown@gmail.com>": mail: missing word in phrase

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux

Which version are you using?  (run 'go version')
1.1.2 linux/amd64

Please provide any additional information below.

http://tip.golang.org/src/pkg/net/mail/message.go?s=3592:3643#L361

   361      // Ignore any error if we got at least one word.
   362      if err != nil && len(words) == 0 {
   363          debug.Printf("consumePhrase: hit err: %v", err)
   364          return "", errors.New("mail: missing word in phrase")
   365      }
   366      phrase = strings.Join(words, " ")
   367      return phrase, nil

That seems wrong, the comment disagrees with the code.
The result being that if you got an error that prevented you from reading at least one
word it gets swallowed up.

Something like (line 364):
   364          return "", fmt.Errorf("mail: missing word in phrase (%s)", err)

would be much more informative.
@dsymonds
Copy link
Contributor

Comment 1:

Labels changed: added priority-later, go1.3, packagebug, size-m, removed priority-triage.

Owner changed to @dsymonds.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-go1.3.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: removed go1.3.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@dsymonds
Copy link
Contributor

dsymonds commented Dec 4, 2013

Comment 6:

We should report this error condition better.

Labels changed: removed priority-later.

@gopherbot
Copy link

Comment 7:

CL https://golang.org/cl/95060043 mentions this issue.

@crawshaw
Copy link
Member

crawshaw commented May 7, 2014

Comment 8:

This issue was closed by revision 8bc1bfb.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants