File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -537,7 +537,19 @@ export class Placement {
537537 const style = element . getAttribute ( ATTR_PREFIX + "style" ) ;
538538 const force_ad = element . getAttribute ( ATTR_PREFIX + "force-ad" ) ;
539539 const force_campaign = element . getAttribute ( ATTR_PREFIX + "force-campaign" ) ;
540- const priority = element . getAttribute ( ATTR_PREFIX + "priority" ) ;
540+ const priorityAttr = element . getAttribute ( ATTR_PREFIX + "priority" ) ;
541+ let priority ;
542+ if ( priorityAttr !== null && priorityAttr !== "" ) {
543+ const parsedPriority = parseInt ( priorityAttr , 10 ) ;
544+ if ( ! Number . isNaN ( parsedPriority ) ) {
545+ priority = parsedPriority ;
546+ } else {
547+ logger . warn (
548+ "EthicalAd: Invalid numerical priority '%s' provided; ignoring." ,
549+ priorityAttr
550+ ) ;
551+ }
552+ }
541553
542554 // Add version to ad type to verison the HTML return
543555 if ( ad_type === "image" || ad_type === "text" ) {
You can’t perform that action at this time.
0 commit comments