mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Epub images bug (xml files)
This commit is contained in:
committed by
Alexey Golubev
parent
ea82bea6f1
commit
f86055c713
@ -51,14 +51,26 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class CHtmlFile_Private
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool m_bIsEpub;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CHtmlFile_Private()
|
||||||
|
{
|
||||||
|
m_bIsEpub = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
CHtmlFile::CHtmlFile()
|
CHtmlFile::CHtmlFile()
|
||||||
{
|
{
|
||||||
|
m_internal = new CHtmlFile_Private();
|
||||||
}
|
}
|
||||||
|
|
||||||
CHtmlFile::~CHtmlFile()
|
CHtmlFile::~CHtmlFile()
|
||||||
{
|
{
|
||||||
|
RELEASEOBJECT(m_internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::wstring GetSdkPath()
|
static std::wstring GetSdkPath()
|
||||||
@ -261,7 +273,20 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
|
|||||||
oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sFilePath));
|
oBuilder.WriteEncodeXmlString(CorrectHtmlPath(sFilePath));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(NSDirectory::GetTempPath(), L"HTM");
|
std::wstring sTmpDir = L"";
|
||||||
|
if (m_internal->m_bIsEpub)
|
||||||
|
{
|
||||||
|
// чтобы ссылки на картинки остались
|
||||||
|
sTmpDir = NSFile::GetDirectoryName(sFilePath);
|
||||||
|
if (!NSDirectory::Exists(sTmpDir))
|
||||||
|
sTmpDir = NSDirectory::GetTempPath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sTmpDir = NSDirectory::GetTempPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring sTmpFile = NSFile::CFileBinary::CreateTempFileWithUniqueName(sTmpDir, L"HTM");
|
||||||
if (NSFile::CFileBinary::Exists(sTmpFile))
|
if (NSFile::CFileBinary::Exists(sTmpFile))
|
||||||
NSFile::CFileBinary::Remove(sTmpFile);
|
NSFile::CFileBinary::Remove(sTmpFile);
|
||||||
|
|
||||||
@ -665,7 +690,10 @@ int CHtmlFile::ConvertEpub(const std::wstring& sFolder, std::wstring& sMetaInfo,
|
|||||||
if (arHtmls.size() == 0)
|
if (arHtmls.size() == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return this->Convert(arHtmls, sDstfolder, sPathInternal);
|
m_internal->m_bIsEpub = true;
|
||||||
|
int nErr = this->Convert(arHtmls, sDstfolder, sPathInternal);
|
||||||
|
m_internal->m_bIsEpub = false;
|
||||||
|
return nErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -42,9 +42,11 @@
|
|||||||
#define HTMLFILE_DECL_EXPORT Q_DECL_EXPORT
|
#define HTMLFILE_DECL_EXPORT Q_DECL_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class CHtmlFile_Private;
|
||||||
class HTMLFILE_DECL_EXPORT CHtmlFile
|
class HTMLFILE_DECL_EXPORT CHtmlFile
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
CHtmlFile_Private* m_internal;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user