diff src/luan/host/main.luan @ 1716:b82767112d8e

add String.regex
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 24 Jul 2022 23:43:03 -0600
parents d6a50ed9604f
children 164c6ea53147
line wrap: on
line diff
--- a/src/luan/host/main.luan	Sat Jul 23 21:53:04 2022 -0600
+++ b/src/luan/host/main.luan	Sun Jul 24 23:43:03 2022 -0600
@@ -7,9 +7,8 @@
 local Rpc = require "luan:Rpc.luan"
 local Thread = require "luan:Thread.luan"
 local String = require "luan:String.luan"
-local regex_quote = String.regex_quote or error()
 local lower = String.lower or error()
-local matches = String.matches or error()
+local starts_with = String.starts_with or error()
 local Hosted = require "luan:host/Hosted.luan"
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "main"
@@ -113,7 +112,7 @@
 end
 
 local function security(site_dir,file)
-	matches( file.to_string(), "^"..regex_quote(site_dir.to_string()) ) or error "security violation"
+	starts_with( file.to_string(), site_dir.to_string() ) or error "security violation"
 end
 
 function fns.copy_file(domain,password,dir,name,content)