- Fixe ID

- Post-Photo gibt msg bei > 20 MB zurück
- Keine Fehlermeldung mehr, wenn Seite keinen Header sendet (Media, Images)
This commit is contained in:
Andreas Bielawski
2016-08-27 14:46:47 +02:00
parent 4d3a67fe5f
commit a5d44d7a15
3 changed files with 23 additions and 17 deletions

View File

@@ -947,22 +947,28 @@ function get_cached_file(url, file_name, receiver, chat_action)
local header, code = get_http_header(url)
-- file size limit is 50 MB
if header["Content-Length"] then
if tonumber(header["Content-Length"]) > 52420000 then
print('file is too large, won\'t send!')
return nil
if header then
if header["Content-Length"] then
if tonumber(header["Content-Length"]) > 52420000 then
print('file is too large, won\'t send!')
return nil
end
elseif header["content-length"] then
if tonumber(header["content-length"]) > 52420000 then
print('file is too large, won\'t send!')
return nil
end
end
elseif header["content-length"] then
if tonumber(header["content-length"]) > 52420000 then
print('file is too large, won\'t send!')
return nil
end
end
if header["last-modified"] then
last_modified = header["last-modified"]
elseif header["Last-Modified"] then
last_modified = header["Last-Modified"]
if header["last-modified"] then
last_modified = header["last-modified"]
elseif header["Last-Modified"] then
last_modified = header["Last-Modified"]
end
else
last_modified = nil
end
if not last_modified then