Skip to content

Commit

Permalink
closes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Oct 1, 2018
1 parent 6624e70 commit 23f559b
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,26 @@ server.route({
})
.code(400)
} else {
if (request.payload.parameter) {
return metaStorer.createTag(request.payload.label, request.payload.parameter.type).catch(e => {
console.log(e);
return e;
});
let regex = /\s|#|,|;|:/ ;
if (!regex.test(request.payload.label)) {
if (request.payload.parameter) {
return metaStorer.createTag(request.payload.label, request.payload.parameter.type).catch(e => {
console.log(e);
return e;
});
} else {
return metaStorer.createTag(request.payload.label).catch(e => {
console.log(e);
return e;
});
}
} else {
return metaStorer.createTag(request.payload.label).catch(e => {
console.log(e);
return e;
});
return h.response({
"statusCode": 400,
"error": "Label contains forbidden charcters",
"message": regex + " matches the Label"
})
.code(400)
}
}
});
Expand Down

0 comments on commit 23f559b

Please sign in to comment.