throw exception if file can't be read
This commit is contained in:
parent
d963dda064
commit
c631ecdc76
|
@ -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');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue