Additional error checking for scratchpads

This commit is contained in:
2026-01-09 09:37:21 +01:00
parent 15cfa01114
commit 6328523624
5 changed files with 39 additions and 5 deletions

View File

@@ -88,8 +88,22 @@ class syntax_plugin_luxtools_scratchpad extends SyntaxPlugin
}
$text = '';
if (@is_file($filePath) && @is_readable($filePath)) {
$text = (string)io_readFile($filePath, false);
$exists = @is_file($filePath);
// If the scratchpad file is missing, render empty content. This allows
// creating the file via the inline editor without showing an error.
if ($exists) {
if (!@is_readable($filePath)) {
$this->renderError($renderer, 'scratchpad_err_unreadable');
return true;
}
$read = io_readFile($filePath, false);
if ($read === false) {
$this->renderError($renderer, 'scratchpad_err_unreadable');
return true;
}
$text = (string)$read;
}
if ($format === 'odt') {