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();
|
$fs = new Filesystem();
|
||||||
if (!$fs->exists($fullPath)) throw $this->createNotFoundException();
|
$contents = $fs->exists($fullPath) ? $fs->readFile($fullPath) : null;
|
||||||
$contents = $fs->readFile($fullPath);
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------- Get data tree ---
|
// -------------------------------------------------- Get data tree ---
|
||||||
|
|
|
@ -26,7 +26,11 @@
|
||||||
{{ _self.render_tree(tree) }}
|
{{ _self.render_tree(tree) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
|
{% if contents is not null %}
|
||||||
{{ contents|markdown_to_html }}
|
{{ contents|markdown_to_html }}
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">Empty</span>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-neutral-3 border-top w-100 p-2">
|
<div class="bg-neutral-3 border-top w-100 p-2">
|
||||||
|
|
Loading…
Reference in New Issue