feat: Don't explode on non-existent files
This commit is contained in:
parent
2d48a4c1a7
commit
5ae258317d
|
@ -38,8 +38,7 @@ final class MainController extends AbstractController
|
|||
);
|
||||
|
||||
$fs = new Filesystem();
|
||||
if (!$fs->exists($fullPath)) throw $this->createNotFoundException();
|
||||
$contents = $fs->readFile($fullPath);
|
||||
$contents = $fs->exists($fullPath) ? $fs->readFile($fullPath) : null;
|
||||
|
||||
|
||||
// -------------------------------------------------- Get data tree ---
|
||||
|
|
|
@ -26,7 +26,11 @@
|
|||
{{ _self.render_tree(tree) }}
|
||||
</div>
|
||||
<div class="p-3">
|
||||
{% if contents is not null %}
|
||||
{{ contents|markdown_to_html }}
|
||||
{% else %}
|
||||
<span class="text-muted">Empty</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-neutral-3 border-top w-100 p-2">
|
||||
|
|
Loading…
Reference in New Issue