mirror of
https://github.com/golang/go.git
synced 2026-04-01 08:57:24 +09:00
[release-branch.go1.25] mime: parse media types that contain braces
This CL fixes a bug introduced by CL 666655: isTokenChar would no longer
(but should) report true for '{' and '}'.
Fixes #76245
Change-Id: Ifc0953c30d7cae7bfba9bc4b6bb6951a83c52576
GitHub-Last-Rev: c91a75c2c8
GitHub-Pull-Request: golang/go#76243
Reviewed-on: https://go-review.googlesource.com/c/go/+/719380
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit c761b26b56)
Reviewed-on: https://go-review.googlesource.com/c/go/+/721000
Reviewed-by: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
committed by
Cherry Mui
parent
433c01e94e
commit
e1ce1bfa7f
@@ -62,7 +62,9 @@ func isTokenChar(c byte) bool {
|
||||
1<<'^' |
|
||||
1<<'_' |
|
||||
1<<'`' |
|
||||
1<<'{' |
|
||||
1<<'|' |
|
||||
1<<'}' |
|
||||
1<<'~'
|
||||
return ((uint64(1)<<c)&(mask&(1<<64-1)) |
|
||||
(uint64(1)<<(c-64))&(mask>>64)) != 0
|
||||
|
||||
@@ -413,6 +413,9 @@ func init() {
|
||||
// Issue #48866: duplicate parameters containing equal values should be allowed
|
||||
{`text; charset=utf-8; charset=utf-8; format=fixed`, "text", m("charset", "utf-8", "format", "fixed")},
|
||||
{`text; charset=utf-8; format=flowed; charset=utf-8`, "text", m("charset", "utf-8", "format", "flowed")},
|
||||
|
||||
// Issue #76236: '{' and '}' are token chars.
|
||||
{"attachment; filename={file}.png", "attachment", m("filename", "{file}.png")},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user