mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-26 02:30:40 +01:00
Allow more characters in file names
This commit is contained in:
parent
4bd5d56909
commit
90d6b3d237
@ -78,6 +78,10 @@ local function mkdir(path)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function check_filename(name)
|
||||||
|
return name:find("^[%w%s%^&'@{}%[%],%$=!%-#%(%)%%%.%+~_]+$") ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_chatcommand("/about", {
|
minetest.register_chatcommand("/about", {
|
||||||
params = "",
|
params = "",
|
||||||
@ -885,11 +889,10 @@ minetest.register_chatcommand("/save", {
|
|||||||
worldedit.player_notify(name, "invalid usage: " .. param)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not param:find("^[a-zA-Z0-9_%-.]+$") then
|
if not check_filename(param) then
|
||||||
worldedit.player_notify(name, "Disallowed file name: " .. param)
|
worldedit.player_notify(name, "Disallowed file name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local result, count = worldedit.serialize(worldedit.pos1[name],
|
local result, count = worldedit.serialize(worldedit.pos1[name],
|
||||||
worldedit.pos2[name])
|
worldedit.pos2[name])
|
||||||
|
|
||||||
@ -923,8 +926,8 @@ minetest.register_chatcommand("/allocate", {
|
|||||||
worldedit.player_notify(name, "invalid usage: " .. param)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not string.find(param, "^[%w \t.,+-_=!@#$%%^&*()%[%]{};'\"]+$") then
|
if not check_filename(param) then
|
||||||
worldedit.player_notify(name, "invalid file name: " .. param)
|
worldedit.player_notify(name, "Disallowed file name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1056,7 +1059,7 @@ minetest.register_chatcommand("/mtschemcreate", {
|
|||||||
worldedit.player_notify(name, "No filename specified")
|
worldedit.player_notify(name, "No filename specified")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not param:find("^[a-zA-Z0-9_%-.]+$") then
|
if not check_filename(param) then
|
||||||
worldedit.player_notify(name, "Disallowed file name: " .. param)
|
worldedit.player_notify(name, "Disallowed file name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -1083,10 +1086,14 @@ minetest.register_chatcommand("/mtschemplace", {
|
|||||||
description = "Load nodes from \"(world folder)/schems/<file>.mts\" with position 1 of the current WorldEdit region as the origin",
|
description = "Load nodes from \"(world folder)/schems/<file>.mts\" with position 1 of the current WorldEdit region as the origin",
|
||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == nil then
|
if param == "" then
|
||||||
worldedit.player_notify(name, "no filename specified")
|
worldedit.player_notify(name, "no filename specified")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if not check_filename(param) then
|
||||||
|
worldedit.player_notify(name, "Disallowed file name: " .. param)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local pos = get_position(name)
|
local pos = get_position(name)
|
||||||
if pos == nil then return end
|
if pos == nil then return end
|
||||||
|
Loading…
Reference in New Issue
Block a user