Problem retrieving attached file name in imapclient

In go 1.21.6 mime/multipart/multipart.go line 88

// FileName returns the filename parameter of the Part's Content-Disposition
// header. If not empty, the filename is passed through filepath.Base (which is
// platform dependent) before being returned.
func (p *Part) FileName() string {
	if p.dispositionParams == nil {
		p.parseContentDisposition()
	}
	filename := p.dispositionParams["filename"]
	if filename == "" {
		return ""
	}
	// RFC 7578, Section 4.2 requires that if a filename is provided, the
	// directory path information must not be used.
	return filepath.Base(filename)
}

If the RFC2047 encoded filename includes “/”, the file name may be truncated and returned in “return filepath.Base(filename)”.
Is there any other way to get the normal filename?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.