Fix bug where missing documentation raises exceptions in Mojo >= 9.0
Change-Id: I569d26f039c0951d603eb413c7dc138d7d0c1c6b
diff --git a/Changes b/Changes
index e348e74..f79dfe9 100755
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.42 2021-06-09
+0.42 2021-06-11
- Added GitHub based CI for perl.
- Added further methods for communicating JSON Files
with the server to the APIs (lerepp).
@@ -19,6 +19,8 @@
- Upgrade Mojolicious dependency to 9.19.
- Added query reference API.
- Use AutoSecrets plugin to improve security.
+ - Fixed bug where missing documentation pages raise
+ exceptions in Mojo >= 9.0.
WARNING: Upgrading to Mojolicious 9.19 will
invalidate all sessions. This is a security update.
diff --git a/lib/Kalamar/Controller/Documentation.pm b/lib/Kalamar/Controller/Documentation.pm
index e70d8f3..6b83dd5 100644
--- a/lib/Kalamar/Controller/Documentation.pm
+++ b/lib/Kalamar/Controller/Documentation.pm
@@ -34,9 +34,9 @@
return $c->render_maybe(
template => $c->loc('Template_' . join('_', @path), join('/', @path))
- ) || $c->render(
+ ) || $c->render_maybe(
template => $c->loc('Template_' . join('_', 'custom', @path), join('/', 'custom', @path))
- );
+ ) || $c->reply->not_found;
};
diff --git a/t/doc.t b/t/doc.t
index ebb3c2b..870dcff 100644
--- a/t/doc.t
+++ b/t/doc.t
@@ -10,6 +10,11 @@
}
});
+# Bug 2021-06-11
+$t->get_ok('/doc/ql/wildcards?cat=1')
+ ->status_is(404)
+ ;
+
# Embedding
$t->get_ok('/doc/ql/poliqarp-plus')
->status_is(200)
@@ -52,7 +57,6 @@
->text_is("title", "KorAP: Poliqarp+")
->text_is('main section > h3', 'Einfache Segmente');
-
$t->get_ok('/doc/ql/annis' => { 'Accept-Language' => 'en-US, en, de-DE' })
->status_is(200)
->text_is("title", "KorAP: Annis QL");