aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2023-10-01 06:54:50 +0530
committersinanmohd <sinan@sinanmohd.com>2023-10-01 07:09:50 +0530
commit21684486a17139741ecfc2c2144eea30e68f46cb (patch)
treeee3a92df1460323bc501699a3cdf77aca8354d16 /server
parent84c397679c6f763fab2e912a6b97076320d66dd1 (diff)
subscene: more error checking
Diffstat (limited to 'server')
-rw-r--r--server/subscene.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/subscene.lua b/server/subscene.lua
index a51b0d6..70ec3c8 100644
--- a/server/subscene.lua
+++ b/server/subscene.lua
@@ -151,7 +151,10 @@ local link_fetch = function (id)
tries = tries + 1
until hcode == 200 or tries > retries
- link = domain .. fetch:match('/subtitles/' .. language .. '%-text/[^"]*')
+ if hcode == 200 then
+ link = domain .. fetch:match('/subtitles/[%l_-]*%-text/[^"]*')
+ end
+
return link, (hcode == 200)
end
@@ -166,7 +169,9 @@ local sub_fetch = function(link, out)
tries = tries + 1
until hcode == 200 or tries > retries
- zcode = util.zip_ext_first(zip, out)
+ if hcode == 200 then
+ zcode = util.zip_ext_first(zip, out)
+ end
os.remove(zip)
return (hcode == 200) and zcode