mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix bug 56275
This commit is contained in:
@ -85,11 +85,71 @@ public:
|
||||
{
|
||||
write(path, (BYTE*)xml.c_str(), (DWORD)xml.length());
|
||||
}
|
||||
bool existsXml(const std::wstring& path)
|
||||
{
|
||||
if (exists(path))
|
||||
return true;
|
||||
|
||||
std::vector<std::wstring> arPieces = getFiles(path, false);
|
||||
if (0 < arPieces.size())
|
||||
{
|
||||
std::sort(arPieces.begin(), arPieces.end());
|
||||
std::vector<std::wstring>::iterator iter = arPieces.begin();
|
||||
while (iter != arPieces.end())
|
||||
{
|
||||
std::wstring::size_type len = iter->length();
|
||||
std::wstring::size_type pos = iter->rfind(L".piece");
|
||||
if (std::wstring::npos != pos && ((pos + 6) == len))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
std::string readXml(const std::wstring& path)
|
||||
{
|
||||
CBuffer* buffer = NULL;
|
||||
if (!read(path, buffer))
|
||||
{
|
||||
std::vector<std::wstring> arPieces = getFiles(path, false);
|
||||
if (0 < arPieces.size())
|
||||
{
|
||||
std::sort(arPieces.begin(), arPieces.end());
|
||||
std::vector<std::wstring>::iterator iter = arPieces.begin();
|
||||
while (iter != arPieces.end())
|
||||
{
|
||||
std::wstring::size_type len = iter->length();
|
||||
std::wstring::size_type pos = iter->rfind(L".piece");
|
||||
if (std::wstring::npos != pos && ((pos + 6) == len))
|
||||
{
|
||||
iter++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
iter = arPieces.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 < arPieces.size())
|
||||
{
|
||||
std::string sResult;
|
||||
for (std::vector<std::wstring>::iterator iter = arPieces.begin(); iter != arPieces.end(); iter++)
|
||||
{
|
||||
CBuffer* bufferPiece = NULL;
|
||||
if (read(*iter, bufferPiece))
|
||||
{
|
||||
sResult += std::string((char*)bufferPiece->Buffer, (size_t)bufferPiece->Size);
|
||||
}
|
||||
delete bufferPiece;
|
||||
}
|
||||
return sResult;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
std::string sXmlUtf8((char*)buffer->Buffer, (size_t)buffer->Size);
|
||||
delete buffer;
|
||||
return sXmlUtf8;
|
||||
|
||||
@ -236,10 +236,10 @@ namespace XPS
|
||||
ReadAttribute(oReader, L"Source", wsSource);
|
||||
|
||||
std::wstring wsPagePath = wsSource;
|
||||
if (!m_wsPath->exists(wsPagePath))
|
||||
if (!m_wsPath->existsXml(wsPagePath))
|
||||
{
|
||||
wsPagePath = wsFilePath + wsSource;
|
||||
if (!m_wsPath->exists(wsPagePath))
|
||||
if (!m_wsPath->existsXml(wsPagePath))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user