Revert "Fix UTF double encoding in file editor" (#2236)

This commit is contained in:
Charles
2026-02-15 11:08:01 -05:00
committed by GitHub
parent 44f6cf8928
commit fdcfbb00ca
3 changed files with 3 additions and 7 deletions
@@ -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) {