From 0b41f38661d4ce3f90ad4df7cc5a17efae8352aa Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 16 Apr 2021 23:05:12 +0200 Subject: Added basic backend code, two api endpoints & sanitization --- api/sanitization.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 api/sanitization.js (limited to 'api/sanitization.js') 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 -- cgit v1.2.3-18-g5258