mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
Revert "Fix UTF double encoding in file editor" (#2236)
This commit is contained in:
@@ -149,11 +149,7 @@ class EditFiles extends Page
|
||||
try {
|
||||
$contents = $this->getDaemonFileRepository()->getContent($this->path, config('panel.files.max_edit_size'));
|
||||
|
||||
if (mb_check_encoding($contents, 'UTF-8')) {
|
||||
return $contents;
|
||||
}
|
||||
|
||||
return mb_convert_encoding($contents, 'UTF-8', 'ISO-8859-1');
|
||||
return mb_convert_encoding($contents, 'UTF-8', ['UTF-8', 'UTF-16', 'ISO-8859-1', 'ASCII']);
|
||||
} catch (FileSizeTooLargeException) {
|
||||
AlertBanner::make('file_too_large')
|
||||
->title(trans('server/file.alerts.file_too_large.title', ['name' => basename($this->path)]))
|
||||
|
||||
@@ -77,7 +77,7 @@ class FileController extends ClientApiController
|
||||
->property('file', $request->get('file'))
|
||||
->log();
|
||||
|
||||
return new Response($response, Response::HTTP_OK, ['Content-Type' => 'text/plain; charset=utf-8']);
|
||||
return new Response($response, Response::HTTP_OK, ['Content-Type' => 'text/plain']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ class DaemonFileRepository extends DaemonRepository
|
||||
{
|
||||
$response = $this->getHttpClient()
|
||||
->withQueryParameters(['file' => $path])
|
||||
->withBody($content, 'text/plain')
|
||||
->withBody($content)
|
||||
->post("/api/servers/{$this->server->uuid}/files/write");
|
||||
|
||||
if ($response->status() === 400) {
|
||||
|
||||
Reference in New Issue
Block a user