🐛 Fix patchmanifest verification

This commit is contained in:
C-3PO 2018-07-08 21:23:01 +02:00
parent 625b2af601
commit 5574da3189
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -146,12 +146,15 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
if (ExtraData.type !== 'element' || ExtraData.name !== 'ExtraData' || ExtraData.attributes !== undefined) { if (ExtraData.type !== 'element' || ExtraData.name !== 'ExtraData' || ExtraData.attributes !== undefined) {
throw new Error(`Expected ExtraData element in patch ${fromNum}to${toNum}.`); throw new Error(`Expected ExtraData element in patch ${fromNum}to${toNum}.`);
} }
if (ExtraData.elements === undefined || (product === 'assets_swtor_fr_fr' && fromNum === '132' && toNum === '130')) { const isPatchWithoutExtraData = product === 'assets_swtor_fr_fr' && fromNum === '132' && toNum === '130';
if (ExtraData.elements === undefined && !isPatchWithoutExtraData) {
throw new Error(`Expected ExtraData element with children in patch ${fromNum}to${toNum}.`); throw new Error(`Expected ExtraData element with children in patch ${fromNum}to${toNum}.`);
} }
for (let j = 0, jl = ExtraData.elements.length; j < jl; j += 1) { if (!isPatchWithoutExtraData) {
const ExtraDataItems = ExtraData.elements as xmlJs.Element[];
for (let j = 0, jl = ExtraDataItems.length; j < jl; j += 1) {
//<ExtraDataItem> //<ExtraDataItem>
const ExtraDataItem = ExtraData.elements[j]; const ExtraDataItem = ExtraDataItems[j];
if (ExtraDataItem.type !== 'element' || ExtraDataItem.name !== 'ExtraDataItem' || ExtraDataItem.attributes !== undefined || ExtraDataItem.elements === undefined || ExtraDataItem.elements.length !== 2) { if (ExtraDataItem.type !== 'element' || ExtraDataItem.name !== 'ExtraDataItem' || ExtraDataItem.attributes !== undefined || ExtraDataItem.elements === undefined || ExtraDataItem.elements.length !== 2) {
throw new Error('Expected ExtraDataItem element.'); throw new Error('Expected ExtraDataItem element.');
} }
@ -192,3 +195,4 @@ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product
} }
} }
} }
}