Make sure toe escape directory and names
This commit is contained in:
@@ -4,6 +4,10 @@ Cache = false
|
|||||||
HideFromProviderlist = true
|
HideFromProviderlist = true
|
||||||
SearchName = true
|
SearchName = true
|
||||||
|
|
||||||
|
local function ShellEscape(s)
|
||||||
|
return "'" .. s:gsub("'", "'\\''") .. "'"
|
||||||
|
end
|
||||||
|
|
||||||
function FormatName(filename)
|
function FormatName(filename)
|
||||||
-- Remove leading number and dash
|
-- Remove leading number and dash
|
||||||
local name = filename:gsub("^%d+", ""):gsub("^%-", "")
|
local name = filename:gsub("^%d+", ""):gsub("^%-", "")
|
||||||
@@ -42,9 +46,8 @@ function GetEntries()
|
|||||||
|
|
||||||
for _, wallpaper_dir in ipairs(dirs) do
|
for _, wallpaper_dir in ipairs(dirs) do
|
||||||
local handle = io.popen(
|
local handle = io.popen(
|
||||||
"find '"
|
"find " .. ShellEscape(wallpaper_dir)
|
||||||
.. wallpaper_dir
|
.. " -maxdepth 1 -type f \\( -name '*.jpg' -o -name '*.jpeg' -o -name '*.png' -o -name '*.gif' -o -name '*.bmp' -o -name '*.webp' \\) 2>/dev/null | sort"
|
||||||
.. "' -maxdepth 1 -type f \\( -name '*.jpg' -o -name '*.jpeg' -o -name '*.png' -o -name '*.gif' -o -name '*.bmp' -o -name '*.webp' \\) 2>/dev/null"
|
|
||||||
)
|
)
|
||||||
if handle then
|
if handle then
|
||||||
for background in handle:lines() do
|
for background in handle:lines() do
|
||||||
@@ -55,7 +58,7 @@ function GetEntries()
|
|||||||
Text = FormatName(filename),
|
Text = FormatName(filename),
|
||||||
Value = background,
|
Value = background,
|
||||||
Actions = {
|
Actions = {
|
||||||
activate = "omarchy-theme-bg-set '" .. background .. "'",
|
activate = "omarchy-theme-bg-set " .. ShellEscape(background),
|
||||||
},
|
},
|
||||||
Preview = background,
|
Preview = background,
|
||||||
PreviewType = "file",
|
PreviewType = "file",
|
||||||
|
|||||||
Reference in New Issue
Block a user