From 0f8f18943b5e70e1f266e262a4161c4372613539 Mon Sep 17 00:00:00 2001 From: James Collins Date: Wed, 22 Feb 2023 20:21:34 +1000 Subject: [PATCH] fix response errors --- app/Http/Controllers/Api/MediaController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/MediaController.php b/app/Http/Controllers/Api/MediaController.php index 6ac20a3..9fdf11fa 100644 --- a/app/Http/Controllers/Api/MediaController.php +++ b/app/Http/Controllers/Api/MediaController.php @@ -59,7 +59,7 @@ class MediaController extends ApiController { $file = $request->file('file'); if ($file === null) { - return $this->respondError(['file' => 'An error occurred uploading the file to the server.']); + return $this->respondWithErrors(['file' => 'The browser did not upload the file correctly to the server.']); } if ($file->isValid() !== true) { @@ -68,9 +68,9 @@ class MediaController extends ApiController case UPLOAD_ERR_FORM_SIZE: return $this->respondTooLarge(); case UPLOAD_ERR_PARTIAL: - return $this->respondError(['file' => 'The file upload was interrupted.']); + return $this->respondWithErrors(['file' => 'The file upload was interrupted.']); default: - return $this->respondError(['file' => 'An error occurred uploading the file to the server.']); + return $this->respondWithErrors(['file' => 'An error occurred uploading the file to the server.']); } } @@ -82,7 +82,7 @@ class MediaController extends ApiController $mime = $file->getMimeType(); $fileInfo = Media::store($file, empty($request->input('permission'))); if ($fileInfo === null) { - return $this->respondError( + return $this->respondWithErrors( ['file' => 'The file could not be stored on the server'], HttpResponseCodes::HTTP_INTERNAL_SERVER_ERROR ); @@ -121,7 +121,7 @@ class MediaController extends ApiController $oldPath = $medium->path(); $fileInfo = Media::store($file, empty($request->input('permission'))); if ($fileInfo === null) { - return $this->respondError( + return $this->respondWithErrors( ['file' => 'The file could not be stored on the server'], HttpResponseCodes::HTTP_INTERNAL_SERVER_ERROR );