throw exception if file can't be read

This commit is contained in:
korelstar 2020-06-11 12:53:35 +02:00
parent d963dda064
commit c631ecdc76
1 changed files with 3 additions and 0 deletions

View File

@ -36,6 +36,9 @@ class Note {
public function getContent() : string {
$content = $this->file->getContent();
if (!is_string($content)) {
throw new \Exception('Can\'t read file content.');
}
if (!mb_check_encoding($content, 'UTF-8')) {
$content = mb_convert_encoding($content, 'UTF-8');
}