From 5d03c0d2e593e226067ed6bfb35a867bd432ee5a Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Wed, 16 Dec 2020 21:38:46 -0800 Subject: [PATCH] Properly handle loading files with special characters --- app/Http/Controllers/Api/Client/Servers/FileController.php | 4 ++-- resources/scripts/api/server/files/loadDirectory.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index a4b0ae283..961b7cd02 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -72,7 +72,7 @@ class FileController extends ClientApiController { $contents = $this->fileRepository ->setServer($server) - ->getDirectory(rawurldecode($request->get('directory') ?? '/')); + ->getDirectory($request->get('directory') ?? '/'); return $this->fractal->collection($contents) ->transformWith($this->getTransformer(FileObjectTransformer::class)) @@ -93,7 +93,7 @@ class FileController extends ClientApiController { return new Response( $this->fileRepository->setServer($server)->getContent( - rawurldecode($request->get('file')), config('pterodactyl.files.max_edit_size') + $request->get('file'), config('pterodactyl.files.max_edit_size') ), Response::HTTP_OK, ['Content-Type' => 'text/plain'] diff --git a/resources/scripts/api/server/files/loadDirectory.ts b/resources/scripts/api/server/files/loadDirectory.ts index 985b5c94d..d53a2634f 100644 --- a/resources/scripts/api/server/files/loadDirectory.ts +++ b/resources/scripts/api/server/files/loadDirectory.ts @@ -20,7 +20,7 @@ export default async (uuid: string, directory?: string): Promise = const { data } = await http.get(`/api/client/servers/${uuid}/files/list`, { // At this point the directory is still encoded so we need to decode it since axios // will automatically re-encode this value before sending it along in the request. - params: { directory: decodeURI(directory ?? '/') }, + params: { directory: directory ?? '/' }, }); return (data.data || []).map(rawDataToFileObject);