Skip to content

Commit

Permalink
Fixed VAST matching.
Browse files Browse the repository at this point in the history
  • Loading branch information
And1sS committed Oct 9, 2024
1 parent e00b80c commit 1a39c76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;

Expand All @@ -29,7 +30,7 @@ public class AppVideoHtmlCorrection implements Correction {
private static final ConditionalLogger conditionalLogger = new ConditionalLogger(
LoggerFactory.getLogger(AppVideoHtmlCorrection.class));

private static final Pattern VAST_XML_PATTERN = Pattern.compile("<\\w*VAST\\w+", Pattern.CASE_INSENSITIVE);
private static final Pattern VAST_XML_PATTERN = Pattern.compile("<\\s*VAST.+>", Pattern.CASE_INSENSITIVE);
private static final TypeReference<ExtPrebid<ExtBidPrebid, ObjectNode>> EXT_BID_PREBID_TYPE_REFERENCE =
new TypeReference<>() {
};
Expand All @@ -42,7 +43,7 @@ public class AppVideoHtmlCorrection implements Correction {
private final double logSamplingRate;

public AppVideoHtmlCorrection(ObjectMapper mapper, double logSamplingRate) {
this.mapper = mapper;
this.mapper = Objects.requireNonNull(mapper);
this.logSamplingRate = logSamplingRate;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void applyShouldNotChangeBidResponsesWhenBidIsVideoAndHasVastXmlInAdm() {
final List<BidderResponse> givenResponses = List.of(
BidderResponse.of("bidderA", null, 100),
BidderResponse.of("bidderB", BidderSeatBid.of(
List.of(givenBid("<anythingvAstanything", BidType.video))), 100));
List.of(givenBid("< \tVAST anything>", BidType.video))), 100));

// when
final List<BidderResponse> actual = target.apply(givenConfig, givenResponses);
Expand Down

0 comments on commit 1a39c76

Please sign in to comment.