mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:50:58 +00:00
Merge pull request #3703 from jkylin/develop
email的Attach和AttachFile 的参数检查逻辑有误。len(args) < 1 && len(args) > 2 改为 l…
This commit is contained in:
commit
d6c2a9fd4b
@ -162,7 +162,7 @@ func (e *Email) Bytes() ([]byte, error) {
|
|||||||
|
|
||||||
// AttachFile Add attach file to the send mail
|
// AttachFile Add attach file to the send mail
|
||||||
func (e *Email) AttachFile(args ...string) (a *Attachment, err error) {
|
func (e *Email) AttachFile(args ...string) (a *Attachment, err error) {
|
||||||
if len(args) < 1 && len(args) > 2 {
|
if len(args) < 1 || len(args) > 2 { // change && to ||
|
||||||
err = errors.New("Must specify a file name and number of parameters can not exceed at least two")
|
err = errors.New("Must specify a file name and number of parameters can not exceed at least two")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ func (e *Email) AttachFile(args ...string) (a *Attachment, err error) {
|
|||||||
// Attach is used to attach content from an io.Reader to the email.
|
// Attach is used to attach content from an io.Reader to the email.
|
||||||
// Parameters include an io.Reader, the desired filename for the attachment, and the Content-Type.
|
// Parameters include an io.Reader, the desired filename for the attachment, and the Content-Type.
|
||||||
func (e *Email) Attach(r io.Reader, filename string, args ...string) (a *Attachment, err error) {
|
func (e *Email) Attach(r io.Reader, filename string, args ...string) (a *Attachment, err error) {
|
||||||
if len(args) < 1 && len(args) > 2 {
|
if len(args) < 1 || len(args) > 2 { // change && to ||
|
||||||
err = errors.New("Must specify the file type and number of parameters can not exceed at least two")
|
err = errors.New("Must specify the file type and number of parameters can not exceed at least two")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user