Skip to content

Commit 5d03c0d

Browse files
committed
Properly handle loading files with special characters
1 parent 0084b48 commit 5d03c0d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/Http/Controllers/Api/Client/Servers/FileController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function directory(ListFilesRequest $request, Server $server): array
7272
{
7373
$contents = $this->fileRepository
7474
->setServer($server)
75-
->getDirectory(rawurldecode($request->get('directory') ?? '/'));
75+
->getDirectory($request->get('directory') ?? '/');
7676

7777
return $this->fractal->collection($contents)
7878
->transformWith($this->getTransformer(FileObjectTransformer::class))
@@ -93,7 +93,7 @@ public function contents(GetFileContentsRequest $request, Server $server): Respo
9393
{
9494
return new Response(
9595
$this->fileRepository->setServer($server)->getContent(
96-
rawurldecode($request->get('file')), config('pterodactyl.files.max_edit_size')
96+
$request->get('file'), config('pterodactyl.files.max_edit_size')
9797
),
9898
Response::HTTP_OK,
9999
['Content-Type' => 'text/plain']

resources/scripts/api/server/files/loadDirectory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default async (uuid: string, directory?: string): Promise<FileObject[]> =
2020
const { data } = await http.get(`/api/client/servers/${uuid}/files/list`, {
2121
// At this point the directory is still encoded so we need to decode it since axios
2222
// will automatically re-encode this value before sending it along in the request.
23-
params: { directory: decodeURI(directory ?? '/') },
23+
params: { directory: directory ?? '/' },
2424
});
2525

2626
return (data.data || []).map(rawDataToFileObject);

0 commit comments

Comments
 (0)