From 5fb505e97bca59badf137b524c54629fa51a8d65 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 20 Jun 2022 14:11:47 +0300 Subject: Jabber: added code to handle file size error, if HTTP Upload service sets the limit --- protocols/JabberG/src/jabber_ft.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index e0f17beb94..b3e3845692 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -127,6 +127,12 @@ void CJabberProto::FtInitiate(filetransfer *ft) struct _stat64 st; _wstat64(ft->std.szCurrentFile.w, &st); + uint32_t maxsize = getDword("HttpUploadMaxSize"); + if (maxsize && st.st_size > maxsize) { + MsgPopup(ft->std.hContact, CMStringW(FORMAT, TranslateT("%s is too large. Maximum size supported by the service is %d KB"), ft->std.szCurrentFile.w, maxsize), L"HTTP Upload"); + goto LBL_Error; + } + auto *pwszContentType = ProtoGetAvatarMimeType(ProtoGetAvatarFileFormat(ft->std.szCurrentFile.w)); if (pwszContentType == nullptr) pwszContentType = "application/octet-stream"; -- cgit v1.2.3