Skip to content

Commit

Permalink
Merge pull request #1738 from akto-api-security/hotfix/adding_null_ch…
Browse files Browse the repository at this point in the history
…eck_for_empty_sampledata

fix: adding null and undefined check for empty sample data
  • Loading branch information
notshivansh authored Nov 19, 2024
2 parents e1f0260 + 5103bab commit 07d349b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/dashboard/web/polaris_web/web/src/util/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ prettifyEpoch(epoch) {
},
requestJson: function (message, highlightPaths) {

if(message==undefined){
if(!message || typeof message !== "object" || Object.keys(message).length === 0){
return {}
}
let result = {}
Expand All @@ -464,8 +464,8 @@ prettifyEpoch(epoch) {
requestPayloadString = message["request"]["body"] || "{}"
} else {
let url = message["path"]
let urlSplit = url.split("?")
queryParamsString = urlSplit.length > 1 ? urlSplit[1] : ""
let urlSplit = (typeof url === "string") ? url?.split("?") : []
queryParamsString = urlSplit?.length > 1 ? urlSplit[1] : ""

requestHeadersString = message["requestHeaders"] || "{}"
requestPayloadString = message["requestPayload"] || "{}"
Expand Down Expand Up @@ -515,7 +515,7 @@ prettifyEpoch(epoch) {
},
responseJson: function (message, highlightPaths) {

if(message==undefined){
if(!message || typeof message !== "object" || Object.keys(message).length === 0){
return {}
}
let result = {}
Expand Down

0 comments on commit 07d349b

Please sign in to comment.