Properly handle loading files with special characters
This commit is contained in:
parent
0084b48d86
commit
5d03c0d2e5
2 changed files with 3 additions and 3 deletions
|
@ -72,7 +72,7 @@ class FileController extends ClientApiController
|
||||||
{
|
{
|
||||||
$contents = $this->fileRepository
|
$contents = $this->fileRepository
|
||||||
->setServer($server)
|
->setServer($server)
|
||||||
->getDirectory(rawurldecode($request->get('directory') ?? '/'));
|
->getDirectory($request->get('directory') ?? '/');
|
||||||
|
|
||||||
return $this->fractal->collection($contents)
|
return $this->fractal->collection($contents)
|
||||||
->transformWith($this->getTransformer(FileObjectTransformer::class))
|
->transformWith($this->getTransformer(FileObjectTransformer::class))
|
||||||
|
@ -93,7 +93,7 @@ class FileController extends ClientApiController
|
||||||
{
|
{
|
||||||
return new Response(
|
return new Response(
|
||||||
$this->fileRepository->setServer($server)->getContent(
|
$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,
|
Response::HTTP_OK,
|
||||||
['Content-Type' => 'text/plain']
|
['Content-Type' => 'text/plain']
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default async (uuid: string, directory?: string): Promise<FileObject[]> =
|
||||||
const { data } = await http.get(`/api/client/servers/${uuid}/files/list`, {
|
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
|
// 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.
|
// 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);
|
return (data.data || []).map(rawDataToFileObject);
|
||||||
|
|
Loading…
Reference in a new issue