- 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

@ -31,9 +31,9 @@ function id:user_print_name(user) -- Yes, copied from stats plugin
local text = ''
if user.first_name then
text = user.last_name..' '
text = user.first_name..' '
end
if user.lastname then
if user.last_name then
text = text..user.last_name
end

View File

@ -17,7 +17,7 @@ function post_photo:pre_process(msg, config)
local file_size = msg.document.file_size
if file_size > 19922944 then
print('File is over 20 MB - can\'t download :(')
return
return msg
end
utilities.send_typing(msg.chat.id, 'upload_photo')

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