Skip to content

Commit

Permalink
use error in pledge
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-babu committed Feb 17, 2020
1 parent 160cfe7 commit fe8d3c2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions https.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,16 @@ function security (req, res, next)
function object_to_array (o)
{
if (o instanceof Object)
o = [o];
{
if (o instanceof Array)
return o;
else
return [o];
}

if (o instanceof Array)
return o;
else
return null;
return null;
}


/* --- APIs --- */

app.post("/auth/v1/token", function (req, res) {
Expand Down Expand Up @@ -880,12 +881,14 @@ app.post("/auth/v1/token", function (req, res) {
{
let resource = row["resource-id"];

console.log("Got",resource);

if (! is_string_safe(resource, "*_")) // allow some chars
{
return END_ERROR (
res, 400,
"Invalid 'resource-id " +
"(contains unsafe chars)' :" + resource
"(contains unsafe chars)' : " + resource
);
}

Expand Down

0 comments on commit fe8d3c2

Please sign in to comment.