mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Merge pull request 'Fix html bugs' (#547) from fix/html into release/v9.2.0
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/core/pulls/547
This commit is contained in:
@ -246,6 +246,11 @@ namespace NSSystemPath
|
|||||||
|
|
||||||
wsNewPath.pop_back();
|
wsNewPath.pop_back();
|
||||||
|
|
||||||
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
|
if (L'/' == strPath[0] || L'\\' == strPath[0])
|
||||||
|
return L'/' + wsNewPath;
|
||||||
|
#endif
|
||||||
|
|
||||||
return wsNewPath;
|
return wsNewPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4396,41 +4396,42 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sSrcM.empty())
|
if (sSrcM.empty())
|
||||||
{
|
{
|
||||||
ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData);
|
ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData);
|
||||||
return true;
|
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();
|
const bool bIsAllowExternalLocalFiles = GetStatusUsingExternalLocalFiles();
|
||||||
|
|
||||||
bool bIsBase64 = false;
|
if (!bRes && (sSrcM.length() <= 7 || L"http" != sSrcM.substr(0, 4)))
|
||||||
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)))
|
|
||||||
{
|
{
|
||||||
sSrcM = NSSystemPath::ShortenPath(sSrcM);
|
sSrcM = NSSystemPath::ShortenPath(sSrcM);
|
||||||
|
|
||||||
if (!CanUseThisPath(sSrcM, m_sSrc, m_sCore, bIsAllowExternalLocalFiles))
|
if (!CanUseThisPath(sSrcM, m_sSrc, m_sCore, bIsAllowExternalLocalFiles))
|
||||||
|
{
|
||||||
|
ImageAlternative(oXml, sSelectors, oTS, wsAlt, sSrcM, oImageData);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nImageId = -1;
|
|
||||||
std::wstring sExtention;
|
|
||||||
// Предполагаем картинку в Base64
|
|
||||||
if (bIsBase64)
|
|
||||||
bRes = readBase64(sSrcM, sExtention);
|
|
||||||
|
|
||||||
// Проверка расширения
|
// Проверка расширения
|
||||||
sExtention = NSFile::GetFileExtention(sSrcM);
|
if (!bRes)
|
||||||
std::transform(sExtention.begin(), sExtention.end(), sExtention.begin(), tolower);
|
{
|
||||||
|
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)
|
if (sExtention.cend() != itFound)
|
||||||
sExtention.erase(itFound, sExtention.cend());
|
sExtention.erase(itFound, sExtention.cend());
|
||||||
|
}
|
||||||
|
|
||||||
// Предполагаем картинку в сети
|
// Предполагаем картинку в сети
|
||||||
if (!bRes &&
|
if (!bRes &&
|
||||||
@ -4467,6 +4468,8 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nImageId = -1;
|
||||||
|
|
||||||
if (!bRes)
|
if (!bRes)
|
||||||
{
|
{
|
||||||
if (NotValidExtension(sExtention))
|
if (NotValidExtension(sExtention))
|
||||||
|
|||||||
Reference in New Issue
Block a user