From 3340ee7fd8580c20fcbf7dc5e262dea12ee62b26 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 24 Sep 2020 20:27:02 -0700 Subject: [PATCH] Fix bad encoding when handling files; closes #2399 --- app/Http/Controllers/Api/Client/Servers/FileController.php | 4 ++-- app/Repositories/Wings/DaemonFileRepository.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Api/Client/Servers/FileController.php b/app/Http/Controllers/Api/Client/Servers/FileController.php index 1f18259ae..ed3c97b34 100644 --- a/app/Http/Controllers/Api/Client/Servers/FileController.php +++ b/app/Http/Controllers/Api/Client/Servers/FileController.php @@ -70,7 +70,7 @@ class FileController extends ClientApiController { $contents = $this->fileRepository ->setServer($server) - ->getDirectory($request->get('directory') ?? '/'); + ->getDirectory(urlencode($request->get('directory') ?? '/')); return $this->fractal->collection($contents) ->transformWith($this->getTransformer(FileObjectTransformer::class)) @@ -91,7 +91,7 @@ class FileController extends ClientApiController { return new Response( $this->fileRepository->setServer($server)->getContent( - $request->get('file'), config('pterodactyl.files.max_edit_size') + urlencode($request->get('file')), config('pterodactyl.files.max_edit_size') ), Response::HTTP_OK, ['Content-Type' => 'text/plain'] diff --git a/app/Repositories/Wings/DaemonFileRepository.php b/app/Repositories/Wings/DaemonFileRepository.php index 553e39d24..1ae424585 100644 --- a/app/Repositories/Wings/DaemonFileRepository.php +++ b/app/Repositories/Wings/DaemonFileRepository.php @@ -117,8 +117,8 @@ class DaemonFileRepository extends DaemonRepository sprintf('/api/servers/%s/files/create-directory', $this->server->uuid), [ 'json' => [ - 'name' => urldecode($name), - 'path' => urldecode($path), + 'name' => $name, + 'path' => $path, ], ] ); @@ -172,7 +172,7 @@ class DaemonFileRepository extends DaemonRepository sprintf('/api/servers/%s/files/copy', $this->server->uuid), [ 'json' => [ - 'location' => urldecode($location), + 'location' => $location, ], ] );