From c4c9a256d3f99f22671214a7377a439d2bf68df3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 21 Jun 2024 18:11:30 +0300 Subject: ICQ: fix for cyrillic file names in history --- protocols/ICQ-WIM/src/server.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'protocols/ICQ-WIM/src/server.cpp') diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index f1df35bbb2..9f00af8f2a 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -601,8 +601,12 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo // convert a file info into Miranda's file transfer if (pFileInfo) { - auto *p = strrchr(pFileInfo->szUrl, '/'); - auto *pszShortName = (p == nullptr) ? pFileInfo->szUrl.c_str() : p + 1; + auto *pszShortName = pFileInfo->szUrl.c_str(); + int slashPos = pFileInfo->szUrl.ReverseFind('/'); + if (slashPos != -1) { + slashPos++; + pszShortName += slashPos; + } DB::EventInfo dbei(hEvent); dbei.eventType = EVENTTYPE_FILE; @@ -640,7 +644,10 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo if (rc != 0 || st.st_size != iSaveSize) { MHttpRequest nlhr(REQUEST_GET); nlhr.flags = NLHRF_REDIRECT; - nlhr.m_szUrl = mir_urlEncode(szUrl); + if (slashPos == -1) + nlhr.m_szUrl = mir_urlEncode(szUrl); + else + nlhr.m_szUrl = szUrl.Mid(0, slashPos) + mir_urlEncode(szUrl.Mid(slashPos)); nlhr.AddHeader("Sec-Fetch-User", "?1"); nlhr.AddHeader("Sec-Fetch-Site", "cross-site"); nlhr.AddHeader("Sec-Fetch-Mode", "navigate"); -- cgit v1.2.3