Skip to content

Commit

Permalink
null checks, headers, type fix (#1810)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmegill authored Sep 18, 2024
1 parent a3bf3f2 commit 9ceb065
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3499,9 +3499,9 @@ Feel free to reply to this email if you need help.`;
request
// @ts-ignore
.get(url + ipAddress, {
method: "GET",
contentType: contentType,
headers: {
method: "GET",
contentType: contentType,
Authorization:
"Basic " +
Buffer.from(userId + ":" + licenseKey, "utf8").toString("base64"),
Expand Down Expand Up @@ -7352,7 +7352,7 @@ Email verified! You can close this tab or hit the back button.
return;
}

if (finalPid < 0) {
if (finalPid && finalPid < 0) {
fail(res, 500, "polis_err_post_comment_bad_pid");
return;
}
Expand Down Expand Up @@ -12340,6 +12340,7 @@ Thanks for using Polis!
if (
!pcaResult ||
typeof pcaResult !== "object" ||
pcaResult === null ||
!("asPOJO" in pcaResult)
) {
return [];
Expand All @@ -12355,7 +12356,7 @@ Thanks for using Polis!
};
}

const pcaData = pcaResult.asPOJO as PcaData;
const pcaData = (pcaResult as { asPOJO: PcaData }).asPOJO;
pcaData.consensus = pcaData.consensus || {};
pcaData.consensus.agree = pcaData.consensus.agree || [];
pcaData.consensus.disagree = pcaData.consensus.disagree || [];
Expand Down

0 comments on commit 9ceb065

Please sign in to comment.