Skip to content

Commit 8886b04

Browse files
committed
Normalize line endings in file content previews.
1 parent 548b38d commit 8886b04

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

app/V1Module/presenters/UploadedFilesPresenter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ public function actionContent(string $id, ?string $entry = null)
264264
// Remove UTF BOM prefix...
265265
$utf8bom = "\xef\xbb\xbf";
266266
$contents = Strings::replace($contents, "~^$utf8bom~");
267+
$contents = str_replace("\r\n", "\n", $contents); // normalize line endings
267268

268269
$fixedContents = @mb_convert_encoding($contents, 'UTF-8', 'UTF-8');
269270

0 commit comments

Comments
 (0)