Don't crash on incomplete vocabulary configuration#1409
Don't crash on incomplete vocabulary configuration#1409osma merged 2 commits intoNatLibFi:masterfrom
Conversation
If a vocabulary configuration has no `void:uriSpace`, an error message should be shown instead of crashing. This fixes NatLibFi#1408.
|
Kudos, SonarCloud Quality Gate passed!
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1409 +/- ##
============================================
+ Coverage 69.55% 69.57% +0.01%
- Complexity 1650 1651 +1
============================================
Files 32 32
Lines 4257 4259 +2
============================================
+ Hits 2961 2963 +2
Misses 1296 1296
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
|
Thanks for the PR! I wonder what the implications are for omitting uriSpace. I mean, this PR obviously fixes the immediate crash, but the setting is used in several places in both PHP and JS code, so just returning a |
|
Without |
|
I tested this PR locally on a vocabulary with a commented out uriSpace setting. As expected it fixes the immediate PHP crash. But there are consequences on the JS side. When clicking a concept from the hierarchy, this error is shown on the JS console: I traced this to some fragile JS code that is run when doing partial page loads. It can be fixed by this patch to diff --git a/view/scripts.twig b/view/scripts.twig
index 2b77ae9f..725444ec 100644
--- a/view/scripts.twig
+++ b/view/scripts.twig
@@ -31,6 +31,8 @@ var prefLabels = [{"lang": "{{ search_results|first.label.lang }}","label": "{{
{% endif %}
{% if request.vocab and request.vocab.uriSpace %}
var uriSpace = "{{ request.vocab.uriSpace }}";
+{% else %}
+var uriSpace = null;
{% endif %}
var showNotation = {% if request.vocab and not request.vocab.config.showNotation %}false{% else %}true{% endif %};
{% if request.vocab %}I will try to add this fix to this PR branch before merging it. It seems that the |
|
Kudos, SonarCloud Quality Gate passed!
|
|
Thank you for the PR @nichtich ! This will go into the |








If a vocabulary configuration has no
void:uriSpace, an error message should be shown instead of crashing. This closes #1408.