small fixes
This commit is contained in:
@@ -540,6 +540,7 @@ func Install(packagepath string, serial uint) error {
|
||||
|
||||
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
|
||||
L.SetGlobal("packets_bin_dir", lua.LString(cfg.Config.BinDir))
|
||||
L.SetField(L.GetGlobal("os"), "remove", L.NewFunction(internal.SafeRemove))
|
||||
|
||||
if err := L.DoFile(manifest.Hooks.Install); err != nil {
|
||||
log.Panic(err)
|
||||
|
||||
@@ -188,8 +188,8 @@ func IsSafe(str string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func safeRemove(L *lua.LState) int {
|
||||
path := L.ToString(1)
|
||||
func SafeRemove(L *lua.LState) int {
|
||||
path := L.CheckString(1)
|
||||
if !IsSafe(path) {
|
||||
L.Push(lua.LFalse)
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user