Skip to content

Commit

Permalink
pagesource fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gobisakthivel-pubm committed Oct 26, 2023
1 parent a66ecc6 commit 38cd5be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions adapters/adbuttler/adbuttler_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package adbuttler
import (
"encoding/json"
"net/http"
"regexp"
"strconv"
"strings"
"time"
Expand All @@ -28,6 +29,16 @@ type AdButlerRequest struct {

}

func isLowercaseNumbersDashes(s string) bool {
// Define a regular expression pattern to match lowercase letters, numbers, and dashes
pattern := "^[a-z0-9-]+$"
re := regexp.MustCompile(pattern)

// Use the MatchString function to check if the string matches the pattern
return re.MatchString(s)
}


func (a *AdButtlerAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {

commerceExt, siteExt, _,errors := adapters.ValidateCommRequest(request)
Expand All @@ -45,7 +56,9 @@ func (a *AdButtlerAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *a
var adButlerReq AdButlerRequest
//Assign Page Source if Present
if siteExt != nil {
adButlerReq.Source = siteExt.Page
if isLowercaseNumbersDashes(siteExt.Page) {
adButlerReq.Source = siteExt.Page
}
}

//Retrieve AccountID and ZoneID from Request and Build endpoint Url
Expand Down Expand Up @@ -224,5 +237,3 @@ func (a *AdButtlerAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *a

}



2 changes: 1 addition & 1 deletion adapters/adbuttler/adbuttler_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (a *AdButtlerAdapter) GetBidderResponse(request *openrtb2.BidRequest, adBut
ClickUrl: clickUrl,
ClickPrice: clickPrice,
ConversionUrl: conversionUrl,
ProductDetails: productDetails,
}

bid := &openrtb2.Bid{
Expand Down Expand Up @@ -199,4 +200,3 @@ func GenerateConversionUrl(adbutlerID, zoneID, adbUID, productID string) string
return conversionUrl
}


0 comments on commit 38cd5be

Please sign in to comment.