From 8eb0169b5125780b1f5418dd57d335c73793bbce Mon Sep 17 00:00:00 2001 From: RainbowShaggy Date: Thu, 7 Nov 2024 20:22:30 +0100 Subject: [PATCH] Fix uploading and downloading files --- dist/app/Http/Controllers/Api/PatchController.php | 2 +- .../Web/Admin/Tools/FileManagerController.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/app/Http/Controllers/Api/PatchController.php b/dist/app/Http/Controllers/Api/PatchController.php index 1e3c67a..c69e1ef 100644 --- a/dist/app/Http/Controllers/Api/PatchController.php +++ b/dist/app/Http/Controllers/Api/PatchController.php @@ -22,7 +22,7 @@ public function getFileWithPatchline(string $patchlineName, string $hash) : Bina if($gameFile === null) return response()->json('File not found', 404); - $filePath = DIRECTORY_SEPARATOR . str($patchlineName)->lower() . DIRECTORY_SEPARATOR . $gameFile->name; + $filePath = DIRECTORY_SEPARATOR . str($patchlineName)->lower() . DIRECTORY_SEPARATOR . $gameFile->filename; if (!$disk->exists($filePath)) { return response()->json('File not found', 404); diff --git a/dist/app/Http/Controllers/Web/Admin/Tools/FileManagerController.php b/dist/app/Http/Controllers/Web/Admin/Tools/FileManagerController.php index 28867e0..c375cd9 100644 --- a/dist/app/Http/Controllers/Web/Admin/Tools/FileManagerController.php +++ b/dist/app/Http/Controllers/Web/Admin/Tools/FileManagerController.php @@ -61,8 +61,14 @@ public function store(Request $request) $gameFile->hash = $filehash; $gameFile->patchline = $request->input('patchline'); - $gameFile->name = $request->input('game_mod_name')[$i]; - $gameFile->description = $request->input('game_mod_description')[$i]; + if (filled($request->input('game_mod_name'))) { + $gameFile->name = $request->input('game_mod_name')[$i]; + } + + if (filled($request->input('game_mod_description'))) { + $gameFile->description = $request->input('game_mod_description')[$i]; + } + $gameFile->is_additional = $request->input('is_additional'); GameFile::getDisk()->putFileAs(strtolower($gameFile->patchline->name), $file, $gameFile->filename);