HFP-1905 Fix updating for scripts with old update functions

"params" (and "extras", e.g. metadata) flow through each update function
and are changed if necessary. Since "extras" was added later and old
update functions don't return it, we need to ignore undefined values
-- or change every single update function in all content types.
pull/52/head
Oliver Tacke 2018-04-09 11:43:48 +02:00
parent 3b38e273eb
commit 58597460f6
1 changed files with 9 additions and 1 deletions

View File

@ -130,7 +130,15 @@ H5P.ContentUpgradeProcess = (function (Version) {
try {
unnecessaryWrapper(params, function (err, upgradedParams, upgradedExtras) {
params = upgradedParams;
/**
* "params" (and "extras", e.g. metadata) flow through each update function and are changed
* if necessary. Since "extras" was added later and old update functions don't return
* it, we need to ignore undefined values here -- or change every single update function
* in all content types.
*/
if (upgradedExtras) {
extras = upgradedExtras;
}
nextMinor(err);
}, extras);
}