aboutsummaryrefslogtreecommitdiff
path: root/api/sanitization.js
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-04-16 23:05:12 +0200
committerHampusM <hampus@hampusmat.com>2021-04-16 23:05:12 +0200
commit0b41f38661d4ce3f90ad4df7cc5a17efae8352aa (patch)
treedefc5d71613985381dcd03eec081b6eb7b0629ca /api/sanitization.js
parentef256e9e40b5fd0cc741c509e611808cc66bafad (diff)
Added basic backend code, two api endpoints & sanitization
Diffstat (limited to 'api/sanitization.js')
-rw-r--r--api/sanitization.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/api/sanitization.js b/api/sanitization.js
new file mode 100644
index 0000000..5c9d009
--- /dev/null
+++ b/api/sanitization.js
@@ -0,0 +1,10 @@
+function sanitizeRepoName(dirty)
+{
+ const valid_repo_name = /^[a-zA-Z0-9\.\-_]+$/;
+ if(valid_repo_name.test(dirty)) {
+ return true;
+ }
+ return false;
+}
+
+module.exports.sanitizeRepoName = sanitizeRepoName; \ No newline at end of file