|
2 | 2 |
|
3 | 3 | namespace App\V1Module\Presenters; |
4 | 4 |
|
| 5 | +use App\Helpers\MetaFormats\Attributes\File; |
5 | 6 | use App\Helpers\MetaFormats\Attributes\Post; |
6 | 7 | use App\Helpers\MetaFormats\Attributes\Query; |
7 | 8 | use App\Helpers\MetaFormats\Attributes\Path; |
| 9 | +use App\Helpers\MetaFormats\FileRequestType; |
8 | 10 | use App\Helpers\MetaFormats\Validators\VInt; |
9 | 11 | use App\Helpers\MetaFormats\Validators\VString; |
10 | 12 | use App\Helpers\MetaFormats\Validators\VUuid; |
@@ -264,6 +266,7 @@ public function actionContent(string $id, ?string $entry = null) |
264 | 266 | // Remove UTF BOM prefix... |
265 | 267 | $utf8bom = "\xef\xbb\xbf"; |
266 | 268 | $contents = Strings::replace($contents, "~^$utf8bom~"); |
| 269 | + $contents = str_replace("\r\n", "\n", $contents); // normalize line endings |
267 | 270 |
|
268 | 271 | $fixedContents = @mb_convert_encoding($contents, 'UTF-8', 'UTF-8'); |
269 | 272 |
|
@@ -320,6 +323,7 @@ public function checkUpload() |
320 | 323 | * @throws CannotReceiveUploadedFileException |
321 | 324 | * @throws InternalServerException |
322 | 325 | */ |
| 326 | + #[File(FileRequestType::FormData, "The whole file to be uploaded")] |
323 | 327 | public function actionUpload() |
324 | 328 | { |
325 | 329 | $user = $this->getCurrentUser(); |
@@ -439,6 +443,7 @@ public function checkAppendPartial(string $id) |
439 | 443 | */ |
440 | 444 | #[Query("offset", new VInt(), "Offset of the chunk for verification", required: true)] |
441 | 445 | #[Path("id", new VUuid(), "Identifier of the partial file", required: true)] |
| 446 | + #[File(FileRequestType::OctetStream, "A chunk of the uploaded file", required: false)] |
442 | 447 | public function actionAppendPartial(string $id, int $offset) |
443 | 448 | { |
444 | 449 | $partialFile = $this->uploadedPartialFiles->findOrThrow($id); |
|
0 commit comments