Skip to content

Commit

Permalink
[parser] fix issue where ads where merged if the first ad was empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Levin committed Aug 22, 2024
1 parent 9f3dc4d commit e011a6d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/parser/vast_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export class VASTParser extends EventEmitter {
- Inline sequence 2,
- Inline sequence 3
*/

if (
ads.length === 1 &&
wrapperSequence !== undefined &&
Expand Down Expand Up @@ -329,19 +330,7 @@ export class VASTParser extends EventEmitter {
});

return Promise.all(resolveWrappersPromises).then((unwrappedAds) => {
const resolvedAds = util.flatten(unwrappedAds);

if (!resolvedAds.length && this.remainingAds.length > 0) {
const remainingAdsToResolve = this.remainingAds.shift();

return this.resolveAds(remainingAdsToResolve, {
wrapperDepth,
previousUrl,
url,
});
}

return resolvedAds;
return util.flatten(unwrappedAds);
});
}

Expand Down

0 comments on commit e011a6d

Please sign in to comment.