From c7cce459bc172d80931ab263da2231dc7bddf9df Mon Sep 17 00:00:00 2001 From: Kirill Polyakov Date: Wed, 26 Nov 2025 19:21:27 +0300 Subject: [PATCH 1/2] Fix bug #78770 --- HtmlFile2/htmlfile2.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/HtmlFile2/htmlfile2.cpp b/HtmlFile2/htmlfile2.cpp index 8ef049c24d..86776eb3ef 100644 --- a/HtmlFile2/htmlfile2.cpp +++ b/HtmlFile2/htmlfile2.cpp @@ -4396,41 +4396,42 @@ private: } } - if (sSrcM.empty()) { ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData); return true; } + std::wstring sExtention; + + // Предполагаем картинку в Base64 + if (sSrcM.length() > 4 && sSrcM.substr(0, 4) == L"data" && sSrcM.find(L"/", 4) != std::wstring::npos) + bRes = readBase64(sSrcM, sExtention); + const bool bIsAllowExternalLocalFiles = GetStatusUsingExternalLocalFiles(); - bool bIsBase64 = false; - if (sSrcM.length() > 4 && sSrcM.substr(0, 4) == L"data" && sSrcM.find(L"/", 4) != std::wstring::npos) - bIsBase64 = true; - - if (!bIsBase64 && (sSrcM.length() <= 7 || L"http" != sSrcM.substr(0, 4))) + if (!bRes && (sSrcM.length() <= 7 || L"http" != sSrcM.substr(0, 4))) { sSrcM = NSSystemPath::ShortenPath(sSrcM); if (!CanUseThisPath(sSrcM, m_sSrc, m_sCore, bIsAllowExternalLocalFiles)) + { + ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData); return true; + } } - int nImageId = -1; - std::wstring sExtention; - // Предполагаем картинку в Base64 - if (bIsBase64) - bRes = readBase64(sSrcM, sExtention); - // Проверка расширения - sExtention = NSFile::GetFileExtention(sSrcM); - std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower); + if (!bRes) + { + sExtention = NSFile::GetFileExtention(sSrcM); + std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower); - std::wstring::const_iterator itFound = std::find_if(sExtention.cbegin(), sExtention.cend(), [](wchar_t wChar){ return !iswalpha(wChar) && L'+' != wChar; }); + std::wstring::const_iterator itFound = std::find_if(sExtention.cbegin(), sExtention.cend(), [](wchar_t wChar){ return !iswalpha(wChar) && L'+' != wChar; }); - if (sExtention.cend() != itFound) - sExtention.erase(itFound, sExtention.cend()); + if (sExtention.cend() != itFound) + sExtention.erase(itFound, sExtention.cend()); + } // Предполагаем картинку в сети if (!bRes && @@ -4467,6 +4468,8 @@ private: } } + int nImageId = -1; + if (!bRes) { if (NotValidExtension(sExtention)) From 9a9182a1e9509149e3c6da07bc11bd130a80b74b Mon Sep 17 00:00:00 2001 From: Kirill Polyakov Date: Tue, 25 Nov 2025 10:58:14 +0300 Subject: [PATCH 2/2] Fix bug #71375 --- DesktopEditor/common/Path.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DesktopEditor/common/Path.cpp b/DesktopEditor/common/Path.cpp index 02dbafcbde..a0e64687d3 100644 --- a/DesktopEditor/common/Path.cpp +++ b/DesktopEditor/common/Path.cpp @@ -246,6 +246,11 @@ namespace NSSystemPath wsNewPath.pop_back(); + #if !defined(_WIN32) && !defined(_WIN64) + if (L'/' == strPath[0] || L'\\' == strPath[0]) + return L'/' + wsNewPath; + #endif + return wsNewPath; }