mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Fix multipart header parsing in eml.go
The commit modifies the parseMultiPartHeader function to handle optional fields accurately. The delimiter was changed from "; " to ";" and whitespace is being trimmed from the start of optional fields to ensure correct splitting and mapping.
This commit is contained in:
parent
faab5323fd
commit
8b1208949f
1 changed files with 3 additions and 2 deletions
3
eml.go
3
eml.go
|
@ -372,7 +372,8 @@ func parseMultiPartHeader(multiPartHeader string) (header string, optional map[s
|
||||||
headerSplit := strings.SplitN(multiPartHeader, ";", 2)
|
headerSplit := strings.SplitN(multiPartHeader, ";", 2)
|
||||||
header = headerSplit[0]
|
header = headerSplit[0]
|
||||||
if len(headerSplit) == 2 {
|
if len(headerSplit) == 2 {
|
||||||
optSplit := strings.SplitN(headerSplit[1], "=", 2)
|
optString := strings.TrimLeft(headerSplit[1], " ")
|
||||||
|
optSplit := strings.SplitN(optString, "=", 2)
|
||||||
if len(optSplit) == 2 {
|
if len(optSplit) == 2 {
|
||||||
optional[optSplit[0]] = optSplit[1]
|
optional[optSplit[0]] = optSplit[1]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue