diff --git a/Common/3dParty/html/htmltoxhtml.h b/Common/3dParty/html/htmltoxhtml.h index ab26a2575e..62a934a6c3 100644 --- a/Common/3dParty/html/htmltoxhtml.h +++ b/Common/3dParty/html/htmltoxhtml.h @@ -331,13 +331,10 @@ static std::string mhtTohtml(std::string& sFileContent, const std::wstring& sTmp for(auto& item : sRes) { std::string sName = item.first; - std::string ssName; size_t found = sFile.find(sName); size_t sfound = sName.rfind('/'); - if(sfound != std::string::npos) - ssName = sName.substr(0, sfound + 1); if(found == std::string::npos && sfound != std::string::npos) - found = sFile.find(ssName); + found = sFile.find(sName.erase(0, sfound + 1)); while(found != std::string::npos) { size_t fq = sFile.find_last_of("\"\'>", found) + 1; @@ -349,8 +346,6 @@ static std::string mhtTohtml(std::string& sFileContent, const std::wstring& sTmp } else found = sFile.find(sName, tq); - if(found == std::string::npos && sfound != std::string::npos) - found = sFile.find(ssName); } } return sFile; diff --git a/HtmlFile2/htmlfile_private.h b/HtmlFile2/htmlfile_private.h index 9c47d4eeb0..d8b6ba60ea 100644 --- a/HtmlFile2/htmlfile_private.h +++ b/HtmlFile2/htmlfile_private.h @@ -1277,6 +1277,8 @@ private: if(nEndBase == std::wstring::npos) continue; std::wstring sType = sSrcM.substr(nBase, nEndBase - nBase); + if(sType == L"octet-stream") + sType = L"jpg"; sImageName = sImageId + L"." + sType; NSFile::CFileBinary oImageWriter; if(oImageWriter.CreateFileW(m_sDst + L"/word/media/i" + sImageName))