Skip to content
Permalink
Browse files

Fix post data that interleaves with FILES not being handled.

Refs #3997
  • Loading branch information...
markstory committed Jul 18, 2014
1 parent 45725b8 commit 8a2805f7ce8c354bf0dc1850917df09707259351
Showing with 13 additions and 2 deletions.
  1. +2 −1 src/Network/Request.php
  2. +11 −1 tests/TestCase/Network/RequestTest.php
@@ -405,7 +405,8 @@ protected function _processFiles($post, $files) {
if (isset($data['tmp_name']) && is_string($data['tmp_name'])) {
$post[$key] = $data;
} else {
$post[$key] = $this->_processFileData([], $data);
$keyData = isset($post[$key]) ? $post[$key] : [];
$post[$key] = $this->_processFileData($keyData, $data);
}
}
}
@@ -297,7 +297,15 @@ public function testProcessFilesNested() {
],
]
];
$request = new Request(compact('files'));
$post = [
'pictures' => [
0 => ['name' => 'A cat']
],
0 => [
'name' => 'A dog'
]
];
$request = new Request(compact('files', 'post'));
$expected = [
'image_main' => [
'file' => [
@@ -310,6 +318,7 @@ public function testProcessFilesNested() {
],
'pictures' => [
0 => [
'name' => 'A cat',
'file' => [
'name' => 'a-file.png',
'type' => 'image/png',
@@ -320,6 +329,7 @@ public function testProcessFilesNested() {
]
],
0 => [
'name' => 'A dog',
'image' => [
'name' => 'scratch.text',
'type' => 'text/plain',

0 comments on commit 8a2805f

Please sign in to comment.
You can’t perform that action at this time.