aboutsummaryrefslogtreecommitdiff
path: root/api/sanitization.js
diff options
context:
space:
mode:
Diffstat (limited to 'api/sanitization.js')
-rw-r--r--api/sanitization.js14
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