diff options
author | HampusM <hampus@hampusmat.com> | 2021-05-10 12:25:35 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-05-10 12:25:35 +0200 |
commit | 94d26ec2a5270ca19f2e32a8381fd6e1b152c3cd (patch) | |
tree | 99729ab8cc39462ab2a9408299d6dea5d1d5c93e /api/sanitization.js | |
parent | 16778756fb25808a1311403590cd7d36fbbeee6c (diff) |
Added a commit api endpoint & cleaned up a little
Diffstat (limited to 'api/sanitization.js')
-rw-r--r-- | api/sanitization.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/api/sanitization.js b/api/sanitization.js index 5c9d009..95c8810 100644 --- a/api/sanitization.js +++ b/api/sanitization.js @@ -1,10 +1,14 @@ function sanitizeRepoName(dirty) { const valid_repo_name = /^[a-zA-Z0-9\.\-_]+$/; - if(valid_repo_name.test(dirty)) { - return true; - } - return false; + return valid_repo_name.test(dirty); } -module.exports.sanitizeRepoName = sanitizeRepoName;
\ No newline at end of file +function sanitizeCommitID(dirty) +{ + const valid_commit_id = /^[a-fA-F0-9]{40}$/; + return valid_commit_id.test(dirty); +} + +module.exports.sanitizeRepoName = sanitizeRepoName; +module.exports.sanitizeCommitID = sanitizeCommitID;
\ No newline at end of file |