Remove repeated parameters in fixMangledMediaType
4k7 opened this issue · comments
Hi,
Function fixMangledMediaType from header.go does not remove repeated parameters in some situations.
For example from this line
text/html;charset=UTF-8; charset=UTF-8
because space is not present before first charset.
You can fix this by changing:
pair := strings.SplitAfter(p, "=")
if strings.Contains(mtype, pair[0]) {
// Ignore repeated parameters.
continue
}
to this
pair := strings.SplitAfter(p, "=")
if strings.Contains(mtype, strings.TrimSpace(pair[0])) {
// Ignore repeated parameters.
continue
}
Thanks.
Hey man, not trying to be rude, but you are using GitHub wrong. There is an editor built in, and sending a PR will automatically run our unit tests, so you can do all of this without even having a Go development environment. I just created #163 using that method to make sure it works.