fix: 405 error on schedule upload/edit
- Edit.vue: move _method PUT from Inertia options to FormData (Inertia v2 ignores it in options) - Upload.vue: add forceFormData: true for reliable multipart/form-data - AccessCheck: add logging when abort() is triggered with non-200 code - UploadSchedulesController: add request logging for diagnostics - php.ini: increase max_file_uploads from 20 to 50 for bulk uploads
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
post_max_size = 128M
|
post_max_size = 128M
|
||||||
upload_max_filesize = 128M
|
upload_max_filesize = 128M
|
||||||
|
max_file_uploads = 50
|
||||||
|
|
||||||
; OPTIMIZATION: Увеличен лимит памяти для обработки больших IMAP-сообщений
|
; OPTIMIZATION: Увеличен лимит памяти для обработки больших IMAP-сообщений
|
||||||
; Предыдущая ошибка: 256MB было недостаточно для загрузки всех писем
|
; Предыдущая ошибка: 256MB было недостаточно для загрузки всех писем
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Containers\Dashboard\UI\WEB\Controllers;
|
|||||||
use App\Containers\Dashboard\Actions\Schedules\UploadMultipleSchedulesAction;
|
use App\Containers\Dashboard\Actions\Schedules\UploadMultipleSchedulesAction;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Inertia\Inertia;
|
use Inertia\Inertia;
|
||||||
|
|
||||||
class UploadSchedulesController extends Controller
|
class UploadSchedulesController extends Controller
|
||||||
@@ -18,6 +19,10 @@ class UploadSchedulesController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create(): \Inertia\Response
|
public function create(): \Inertia\Response
|
||||||
{
|
{
|
||||||
|
Log::info('UploadSchedules: create called', [
|
||||||
|
'method' => request()->method(),
|
||||||
|
'user_id' => request()->user()?->id,
|
||||||
|
]);
|
||||||
return Inertia::render('Dashboard/Schedules/Upload');
|
return Inertia::render('Dashboard/Schedules/Upload');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,6 +31,14 @@ class UploadSchedulesController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request): \Inertia\Response
|
public function store(Request $request): \Inertia\Response
|
||||||
{
|
{
|
||||||
|
Log::info('UploadSchedules: store called', [
|
||||||
|
'method' => $request->method(),
|
||||||
|
'content_type' => $request->header('Content-Type'),
|
||||||
|
'files_count' => count($request->file('files', [])),
|
||||||
|
'has_inertia_header' => $request->header('X-Inertia') ? 'yes' : 'no',
|
||||||
|
'user_id' => $request->user()?->id,
|
||||||
|
]);
|
||||||
|
|
||||||
// Получаем файлы из request (FormData с files[])
|
// Получаем файлы из request (FormData с files[])
|
||||||
$files = $request->file('files', []);
|
$files = $request->file('files', []);
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Http\Middleware;
|
|||||||
use App\Containers\AppStructure\Models\Page;
|
use App\Containers\AppStructure\Models\Page;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class AccessCheck
|
class AccessCheck
|
||||||
@@ -28,6 +29,13 @@ class AccessCheck
|
|||||||
|
|
||||||
// Если код не 200, возвращаем соответствующий код ошибки
|
// Если код не 200, возвращаем соответствующий код ошибки
|
||||||
if ($registeredRoute->code != 200) {
|
if ($registeredRoute->code != 200) {
|
||||||
|
Log::warning('AccessCheck: abort', [
|
||||||
|
'uri' => $request->route()->uri,
|
||||||
|
'method' => $request->method(),
|
||||||
|
'page_id' => $registeredRoute->id,
|
||||||
|
'code' => $registeredRoute->code,
|
||||||
|
'path' => $registeredRoute->path,
|
||||||
|
]);
|
||||||
abort($registeredRoute->code);
|
abort($registeredRoute->code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -320,8 +320,10 @@ export default {
|
|||||||
formData.append('file[0][path]', this.form.file[0].path);
|
formData.append('file[0][path]', this.form.file[0].path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formData.append('_method', 'PUT');
|
||||||
|
|
||||||
this.$inertia.post(route('dashboard.schedules.update', this.schedule.id), formData, {
|
this.$inertia.post(route('dashboard.schedules.update', this.schedule.id), formData, {
|
||||||
_method: 'PUT',
|
forceFormData: true,
|
||||||
onFinish: () => {
|
onFinish: () => {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -440,6 +440,7 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.$inertia.post(route('dashboard.schedules.upload.store'), formData, {
|
this.$inertia.post(route('dashboard.schedules.upload.store'), formData, {
|
||||||
|
forceFormData: true,
|
||||||
preserveScroll: true,
|
preserveScroll: true,
|
||||||
onError: (errors) => {
|
onError: (errors) => {
|
||||||
this.errors = { ...errors };
|
this.errors = { ...errors };
|
||||||
|
|||||||
Reference in New Issue
Block a user