Skip to content

Commit

Permalink
fix for values with encoded equal signs
Browse files Browse the repository at this point in the history
  • Loading branch information
komkom committed Apr 27, 2023
1 parent 26de42c commit cee000b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/coding/headerext.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func RFC2047Decode(s string) string {

default:
if decoded {
keyValuePair := strings.SplitAfter(s, "=")
keyValuePair := strings.SplitAfterN(s, "=", 2)
if len(keyValuePair) < 2 {
return s
}
Expand Down
6 changes: 6 additions & 0 deletions mediatype/mediatype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ func TestParseMediaType(t *testing.T) {
mtype: "multipart/alternative",
params: map[string]string{"boundary": "<myboundary>"},
},
{
label: "encoded equal sign",
input: "application/pdf; name=\"=?iso-8859-1?Q?key=3Dvalue?=\"",
mtype: "application/pdf",
params: map[string]string{"name": "key=value"},
},
}
for _, tc := range testCases {
t.Run(tc.label, func(t *testing.T) {
Expand Down

0 comments on commit cee000b

Please sign in to comment.