Fix crash when downloading books with unknown characters in title (#2628)

This commit is contained in:
Robert
2017-03-15 08:59:42 +01:00
committed by Qingping Hou
parent d206abc724
commit dccbf4cf96
2 changed files with 36 additions and 32 deletions

View File

@@ -256,11 +256,15 @@ function util.getFilesystemType(path)
end
function util.replaceInvalidChars(str)
return str:gsub('[\\,%/,:,%*,%?,%",%<,%>,%|]','_')
if str then
return str:gsub('[\\,%/,:,%*,%?,%",%<,%>,%|]','_'):gsub("([\224-\244]+)",'_')
end
end
function util.replaceSlashChar(str)
return str:gsub('%/','_')
if str then
return str:gsub('%/','_'):gsub("([\224-\244]+)",'_')
end
end
-- Split a file into its path and name