diff src/admin/add.html.luan @ 21:b14073ab9d07

update luan
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 14 Sep 2024 22:17:26 -0600
parents a7187a447835
children 7c9a45368af2
line wrap: on
line diff
--- a/src/admin/add.html.luan	Mon Aug 05 11:32:22 2024 +0300
+++ b/src/admin/add.html.luan	Sat Sep 14 22:17:26 2024 -0600
@@ -1,7 +1,6 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local String = require "luan:String.luan"
-local matches = String.matches or error()
 local Io = require "luan:Io.luan"
 local Http = require "luan:http/Http.luan"
 local Shared = require "site:/lib/Shared.luan"
@@ -12,11 +11,12 @@
 local save_raw_config = Shared.save_raw_config or error()
 local admin_return = Shared.admin_return or error()
 
+local name_regex = String.regex("^[a-z0-9_][a-z0-9_-]*$")
 
 local function handle()
 	local user = get_user()
 	local repo_name = Http.request.parameters.repo or error()
-	matches( repo_name, "^[a-z0-9_][a-z0-9_-]*$" ) or error "invalid regex name"
+	name_regex.matches( repo_name ) or error "invalid regex name"
 	if repo_name=="_all" or repo_name=="_private" then
 		return [[<p error>Invalid rep name</p>]]
 	end