mirror of
https://github.com/versity/versitygw.git
synced 2026-09-25 17:34:29 +00:00
fix: remove POST object multipart boundary prefix trimming
Fixes the [comment](https://github.com/versity/versitygw/issues/1648#issuecomment-4175425099) Removes the unnecessary multipart/form-data boundary normalizing. The boundary prefix(`--`) was trimmed in `NewMultipartParser`, which caused incorrect boundary check for the boundaries starting with 2 dashes(e.g. `----WebKitFormBoundaryABC123`).
This commit is contained in:
@@ -100,28 +100,28 @@ func TestMultipartParserParseSuccess(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
body := strings.Join([]string{
|
||||
"--abc\r\n",
|
||||
"----abc\r\n",
|
||||
"Content-Disposition: form-data; name=\"key\"\r\n",
|
||||
"\r\n",
|
||||
"uploads/photo.jpg\r\n",
|
||||
"--abc\r\n",
|
||||
"----abc\r\n",
|
||||
"Content-Disposition: form-data; name=\"success_action_status\"\r\n",
|
||||
"\r\n",
|
||||
"201\r\n",
|
||||
"--abc\r\n",
|
||||
"----abc\r\n",
|
||||
"Content-Disposition: form-data; name=\"x-amz-meta-color\"\r\n",
|
||||
"\r\n",
|
||||
"blue\r\n",
|
||||
"--abc\r\n",
|
||||
"----abc\r\n",
|
||||
"Content-Disposition: form-data; name=\"x-amz-meta-color\"\r\n",
|
||||
"\r\n",
|
||||
"green\r\n",
|
||||
"--abc\r\n",
|
||||
"----abc\r\n",
|
||||
"Content-Disposition: form-data; name=\"file\"; filename=\"photo.jpg\"\r\n",
|
||||
"Content-Type: image/jpeg\r\n",
|
||||
"\r\n",
|
||||
"file-body-123",
|
||||
"\r\n--abc--\r\n",
|
||||
"\r\n----abc--\r\n",
|
||||
}, "")
|
||||
|
||||
mp := newMultipartParserForTest(t, body, "--abc")
|
||||
|
||||
Reference in New Issue
Block a user