-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guard against undefined data in translations where semantics has entries #159
base: master
Are you sure you want to change the base?
Conversation
It was found that in version 1.24.2 of "Interactive Video" there are entries in the semantics.json file, where the corresponding entries in the translations are missing. This breaks hard in h5peditor.js, function updateCommonFieldsDefault, where the fields from the semantics entries are iterated and `field` member of the translations entry is accessed without checking, that is actually exists.
Steps to reproduce:
Resulting view In the console:
The failing code accesses the The problem was observed with the version |
I just noticed that this issue and the fix suggestion was already reported by @borovinskiy in #157 and has a suggestion for a fix, that matches this. This fix was created independently though. |
I believe this is trying to fix the symptom of h5p/h5p-interactive-video#258. I believe the real issue was that the translations for IV was invalid, and I suspect trying to accept invalid translation files might turn into worse problems later. |
I disagree. There is already logic in place, that guards against missing data in the translation file: h5p-editor-php-library/scripts/h5peditor.js Line 278 in 53dc7bd
h5p-editor-php-library/scripts/h5peditor.js Line 282 in 53dc7bd
I don't see how this change makes it worse. It just enhances the existing sanity checks. We currently have this change in our productive Moodle instance and it changes the situation from "H5P is utterly broken" to "No problem, all good.". |
Localization errors are not critical and should not break the application. |
@fnoks is there any chance that you reconsider integrating this? I still think, that a program should not rely on input to be well formed and if it is try to do the "most right" thing, which is to go on with the state that it can. It is fine to ask the content developer to provide a new version of the content element, but as shown in the issue you referenced this can take weeks or upstream is just a dead-end and does not care. |
It was found that in version 1.24.2 of "Interactive Video" there are entries in the semantics.json file, where the corresponding entries in the translations are missing. This breaks hard in h5peditor.js, function updateCommonFieldsDefault, where the fields from the semantics entries are iterated and
field
member of the translations entry is accessed without checking, that is actually exists.