naughty: urldecode icon URI file

file:// URIs should be urlencoded; decode URIs where required.

Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
This commit is contained in:
Jonathan McCrohan 2017-02-08 01:15:36 +00:00
parent fe4d6404a6
commit 12e5998698
1 changed files with 2 additions and 0 deletions

View File

@ -569,6 +569,8 @@ function naughty.notify(args)
-- Is this really an URI instead of a path? -- Is this really an URI instead of a path?
if type(icon) == "string" and string.sub(icon, 1, 7) == "file://" then if type(icon) == "string" and string.sub(icon, 1, 7) == "file://" then
icon = string.sub(icon, 8) icon = string.sub(icon, 8)
-- urldecode URI path
icon = string.gsub(icon, "%%(%x%x)", function(x) return string.char(tonumber(x, 16)) end )
end end
-- try to guess icon if the provided one is non-existent/readable -- try to guess icon if the provided one is non-existent/readable
if type(icon) == "string" and not util.file_readable(icon) then if type(icon) == "string" and not util.file_readable(icon) then