mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix bug #71868
This commit is contained in:
@ -133,7 +133,8 @@ _UINT32 COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs
|
||||
oPPTXWriter.m_xmlApp = ((PPT::CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_app_xml;
|
||||
oPPTXWriter.m_xmlCore = ((PPT::CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_core_xml;
|
||||
|
||||
oPPTXWriter.CreateFile(((PPT::CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]);
|
||||
if (false == oPPTXWriter.CreateFile(((PPT::CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]))
|
||||
return AVS_UNIVERSALDOCUMENTCONVERTER_ERROR_CREATE_TEMP_DIR;
|
||||
oPPTXWriter.CloseFile();
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
@ -110,7 +110,7 @@ namespace PPT
|
||||
RELEASEOBJECT(m_pShapeWriter);
|
||||
}
|
||||
|
||||
void CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo)
|
||||
bool CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo)
|
||||
{
|
||||
m_pUserInfo = pUserInfo;
|
||||
|
||||
@ -124,12 +124,15 @@ namespace PPT
|
||||
|
||||
m_pShapeWriter->InitNextId();
|
||||
|
||||
NSDirectory::CreateDirectory(m_strDestPath);
|
||||
if (NSDirectory::CreateDirectory(m_strDestPath) == false)
|
||||
return false;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
std::wstring strMemory;
|
||||
|
||||
// _rels
|
||||
NSDirectory::CreateDirectory(m_strDestPath + FILE_SEPARATOR_STR + L"_rels");
|
||||
if (NSDirectory::CreateDirectory(m_strDestPath + FILE_SEPARATOR_STR + L"_rels") == false)
|
||||
return false;
|
||||
|
||||
oFile.CreateFileW(m_strDestPath + FILE_SEPARATOR_STR + L"_rels" + FILE_SEPARATOR_STR + L".rels");
|
||||
strMemory = NSPPTXWriterConst::g_string_rels_presentation;
|
||||
@ -137,7 +140,8 @@ namespace PPT
|
||||
oFile.CloseFile();
|
||||
|
||||
// docProps
|
||||
NSDirectory::CreateDirectory(m_strDestPath + FILE_SEPARATOR_STR + L"docProps");
|
||||
if (NSDirectory::CreateDirectory(m_strDestPath + FILE_SEPARATOR_STR + L"docProps") == false)
|
||||
return false;
|
||||
|
||||
// core
|
||||
oFile.CreateFileW(m_strDestPath + FILE_SEPARATOR_STR + L"docProps" + FILE_SEPARATOR_STR + L"core.xml");
|
||||
|
||||
@ -60,7 +60,7 @@ namespace PPT
|
||||
~CPPTXWriter();
|
||||
|
||||
void CreateFile(CDocument * pDocument);
|
||||
void CreateFile(CPPTUserInfo* pUserInfo);
|
||||
bool CreateFile(CPPTUserInfo* pUserInfo);
|
||||
|
||||
void CloseFile();
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ CPPTFileReader::CPPTFileReader(POLE::Storage* pStorage, const std::wstring& strT
|
||||
{
|
||||
m_oCommonInfo.tempPath = NSDirectory::GetTempPath();
|
||||
}
|
||||
m_oCommonInfo.tempPath = NSDirectory::CreateDirectoryWithUniqueName(m_oCommonInfo.tempPath);
|
||||
//m_oCommonInfo.tempPath = m_oCommonInfo.tempPath + FILE_SEPARATOR_STR + L"temp";
|
||||
|
||||
m_oDocumentInfo.m_pCommonInfo = &m_oCommonInfo;
|
||||
|
||||
@ -98,7 +98,7 @@ CPPTFileReader::~CPPTFileReader()
|
||||
{
|
||||
RELEASEOBJECT(m_pStorage);
|
||||
|
||||
NSDirectory::DeleteDirectory(m_oCommonInfo.tempPath);
|
||||
//NSDirectory::DeleteDirectory(m_oCommonInfo.tempPath);
|
||||
}
|
||||
|
||||
bool CPPTFileReader::IsPowerPoint()
|
||||
|
||||
@ -66,6 +66,8 @@ vector_string RoundTripExtractor::find(const std::wstring& strRegEx) const
|
||||
|
||||
std::wstring RoundTripExtractor::getOneFile(const std::wstring &shortPath) const
|
||||
{
|
||||
if (m_hasError) return L"";
|
||||
|
||||
const std::wstring fullPath = m_extractedFolderPath + FILE_SEPARATOR_STR + shortPath;
|
||||
|
||||
return NSFile::CFileBinary::Exists(fullPath) ? fullPath : L"";
|
||||
@ -76,7 +78,7 @@ bool RoundTripExtractor::extract()
|
||||
if (!m_roundTripRecord)
|
||||
return false;
|
||||
|
||||
std::wstring tempZipPath = NSFile::CFileBinary::CreateTempFileWithUniqueName(m_tempPath, L"RndT") + L".zip";
|
||||
std::wstring tempZipPath = NSFile::CFileBinary::CreateTempFileWithUniqueName(m_tempPath, L"RndT");
|
||||
|
||||
BYTE* zipData = m_roundTripRecord->data.first.get();
|
||||
ULONG zipDataLen = m_roundTripRecord->data.second;
|
||||
@ -88,11 +90,16 @@ bool RoundTripExtractor::extract()
|
||||
|
||||
COfficeUtils officeUtils(NULL);
|
||||
m_extractedFolderPath = NSDirectory::CreateDirectoryWithUniqueName(m_tempPath);
|
||||
if(S_FALSE == officeUtils.ExtractToDirectory(tempZipPath, m_extractedFolderPath, NULL, 0))
|
||||
|
||||
if (m_extractedFolderPath.empty()) return false;
|
||||
{
|
||||
NSFile::CFileBinary::Remove(tempZipPath);
|
||||
return false;
|
||||
}
|
||||
bool result = (S_FALSE != officeUtils.ExtractToDirectory(tempZipPath, m_extractedFolderPath, NULL, 0));
|
||||
|
||||
NSFile::CFileBinary::Remove(tempZipPath);
|
||||
return true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool RoundTripExtractor::hasError() const
|
||||
|
||||
@ -935,7 +935,7 @@ void CPPTElement::SetUpPropertyShape(CElementPtr pElement, CTheme* pTheme, CSlid
|
||||
case ODRAW::metroBlob:
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
std::wstring tempFileName = NSFile::CFileBinary::CreateTempFileWithUniqueName(m_tempPath, L"Blob") + L".zip";
|
||||
std::wstring tempFileName = NSFile::CFileBinary::CreateTempFileWithUniqueName(m_tempPath, L"Blob");
|
||||
|
||||
if (file.CreateFileW(tempFileName))
|
||||
{
|
||||
@ -2168,8 +2168,7 @@ std::wstring CRecordShapeContainer::getTableXmlStr() const
|
||||
|
||||
if (xmlProp.m_pOptions && xmlProp.m_lValue > 0) // file513.ppt
|
||||
{
|
||||
std::wstring tempPath = NSDirectory::CreateDirectoryWithUniqueName(m_pCommonInfo->tempPath);
|
||||
std::wstring tempFileName = tempPath + FILE_SEPARATOR_STR + L"tempMetroBlob.zip";
|
||||
std::wstring tempFileName = NSFile::CFileBinary::CreateTempFileWithUniqueName(m_pCommonInfo->tempPath, L"Blob");
|
||||
|
||||
NSFile::CFileBinary file;
|
||||
if (file.CreateFileW(tempFileName))
|
||||
@ -2185,7 +2184,6 @@ std::wstring CRecordShapeContainer::getTableXmlStr() const
|
||||
|
||||
delete[] utf8Data;
|
||||
NSFile::CFileBinary::Remove(tempFileName);
|
||||
NSDirectory::DeleteDirectory(tempPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user