mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:30:56 +00:00
email的Attach和AttachFile 的参数检查逻辑有误。len(args) < 1 && len(args) > 2 改为 len(args) < 1 || len(args) > 2
This commit is contained in:
parent
e844058aed
commit
8cfd7f5c19
@ -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