Skip to content

Commit ddd4e5a

Browse files
committed
Normalize line endings in file content previews.
1 parent 47333f6 commit ddd4e5a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)