aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yakushev <yakushev.alex@gmail.com>2011-10-24 13:48:04 +0300
committerAlexander Yakushev <yakushev.alex@gmail.com>2011-10-24 13:54:08 +0300
commit7f02daad133c11af5ee74f6c8fe84c22f5c02eff (patch)
tree592d2c21a2dc7e5b9701a3b48e534d6cd058c0bf
parentf6fecc46e04b77339bfdba688a36e961c26980f3 (diff)
downloadawesompd-7f02daad133c11af5ee74f6c8fe84c22f5c02eff.tar.gz
awesompd-7f02daad133c11af5ee74f6c8fe84c22f5c02eff.tar.bz2
Escape single quotes in folder names (thanks, Blackmore's Night)
-rw-r--r--awesompd.lua10
-rw-r--r--jamendo.lua2
2 files changed, 8 insertions, 4 deletions
diff --git a/awesompd.lua b/awesompd.lua
index f59d77d..447a7cd 100644
--- a/awesompd.lua
+++ b/awesompd.lua
@@ -1,7 +1,7 @@
---------------------------------------------------------------------------
-- @author Alexander Yakushev <yakushev.alex@gmail.com>
-- @copyright 2010-2011 Alexander Yakushev
--- @release v1.0.8
+-- @release v1.0.9
---------------------------------------------------------------------------
awesompd = {}
@@ -991,8 +991,12 @@ function awesompd:try_get_local_cover()
local folder = music_folder .. current_file_folder
- -- Get all images in the folder
- local covers = self.pread("ls '" .. folder .. "' | grep -P '\.jpg\|\.png\|\.gif|\.jpeg'", "*all")
+ -- Get all images in the folder. Also escape occasional single
+ -- quotes in folder name.
+ local request = format("ls '%s' | grep -P '\.jpg\|\.png\|\.gif|\.jpeg'",
+ string.gsub(folder, "'", "'\\''"))
+
+ local covers = self.pread(request, "*all")
local covers_table = self.split(covers)
if covers_table.n > 0 then
diff --git a/jamendo.lua b/jamendo.lua
index 750aa5d..d6cc50a 100644
--- a/jamendo.lua
+++ b/jamendo.lua
@@ -1,7 +1,7 @@
---------------------------------------------------------------------------
-- @author Alexander Yakushev <yakushev.alex@gmail.com>
-- @copyright 2011 Alexander Yakushev
--- @release v1.0.8
+-- @release v1.0.9
---------------------------------------------------------------------------
module('jamendo', package.seeall)