mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix don't makeWritable different files
This commit is contained in:
@ -680,18 +680,25 @@ return 0;
|
||||
sInfo = XMLConverter::DictToXml(L"Info", &info);
|
||||
info.free();
|
||||
|
||||
std::wstring wsPath = m_pInternal->m_pPdfWriter->GetEditPdfPath();
|
||||
bool bRes = m_pInternal->m_pPdfWriter->EditClose(sTrailer, sInfo);
|
||||
GString* owner_pswd = NSStrings::CreateString(sPassword);
|
||||
GString* user_pswd = NSStrings::CreateString(sPassword);
|
||||
bRes &= m_pInternal->m_pPDFDocument->makeWritable(false, owner_pswd, user_pswd);
|
||||
delete owner_pswd;
|
||||
delete user_pswd;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(m_pInternal->m_wsSrcPath))
|
||||
std::string sPathUtf8New = U_TO_UTF8(wsPath);
|
||||
std::string sPathUtf8Old = U_TO_UTF8(m_pInternal->m_wsSrcPath);
|
||||
if (sPathUtf8Old == sPathUtf8New || NSSystemPath::NormalizePath(sPathUtf8Old) == NSSystemPath::NormalizePath(sPathUtf8New))
|
||||
{
|
||||
m_pInternal->m_nFileLength = oFile.GetFileSize();
|
||||
oFile.CloseFile();
|
||||
GString* owner_pswd = NSStrings::CreateString(sPassword);
|
||||
GString* user_pswd = NSStrings::CreateString(sPassword);
|
||||
bRes &= m_pInternal->m_pPDFDocument->makeWritable(false, owner_pswd, user_pswd);
|
||||
delete owner_pswd;
|
||||
delete user_pswd;
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
if (oFile.OpenFile(m_pInternal->m_wsSrcPath))
|
||||
{
|
||||
m_pInternal->m_nFileLength = oFile.GetFileSize();
|
||||
oFile.CloseFile();
|
||||
}
|
||||
}
|
||||
|
||||
return bRes;
|
||||
|
||||
Reference in New Issue
Block a user