Skip to content

Commit 3193a97

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

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($contents, "\r\n", "\n"); // normalize line endings
267268

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

0 commit comments

Comments
 (0)