Skip to content

Commit

Permalink
Merge pull request #9 from bigfoot90/master
Browse files Browse the repository at this point in the history
FIX small typo AND compatibility with Sf<4
  • Loading branch information
goetas authored Feb 13, 2019
2 parents 595f35d + bc5f7a5 commit 48015c8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
cache:
directories:
- $HOME/.composer/cache/files
-

matrix:
fast_finish: true
allow_failures:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ X-Custom-Header: header value
--19D523FB--
```

## Usage
### Controller
Body will not be decoded automatically, you can decode it by yourself or use [FOSRestBundle](https://github.com/FriendsOfSymfony/FOSRestBundle) to handle it transparently
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/MultipartRequestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function processRequest(Request $request)
if ('error' === $params[3]->getName()) { // symfony 4
$file = new UploadedFile($tmpPath, urldecode($fileName), $part->getMimeType(), null, true);
} else { // symfony < 4
$file = new UploadedFile($tmpPath, urldecode($fileName), $part->getMimeType(), filesize($tmpPath), null, false);
$file = new UploadedFile($tmpPath, urldecode($fileName), $part->getMimeType(), filesize($tmpPath), null, true);
}
@$file->ref = $fp;
$attachments[] = $file;
Expand Down
2 changes: 1 addition & 1 deletion tests/EventListener/MultipartRequestListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function testFileUploads()
self::assertEquals('Content', file_get_contents($attachment->getPathname()));
self::assertEquals('Nome file.pdf', $attachment->getClientOriginalName());
self::assertEquals('mime/type', $attachment->getClientMimeType());
self::assertEquals(0, $attachment->getError());
self::assertTrue($attachment->isValid());
}

private function setRequestContent($content)
Expand Down

0 comments on commit 48015c8

Please sign in to comment.