mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-18 18:16:39 +08:00
Merge remote-tracking branch 'origin/release/v6.4.0' into develop
This commit is contained in:
@ -396,6 +396,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// others
|
||||
|
||||
bool bEmptyFile = false;
|
||||
{
|
||||
NSFile::CFileBinary file;
|
||||
if (!file.OpenFile(fileName))
|
||||
@ -408,6 +410,8 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
|
||||
file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);
|
||||
int sizeRead = (int)dwReadBytes;
|
||||
|
||||
bEmptyFile = (dwReadBytes < 1);
|
||||
|
||||
if ( isOOXFlatFormatFile(buffer,sizeRead) )
|
||||
{
|
||||
//nFileType;
|
||||
@ -469,7 +473,7 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
|
||||
if (buffer)delete []buffer;
|
||||
buffer = NULL;
|
||||
}
|
||||
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN)return true;
|
||||
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
//// by Extension
|
||||
|
||||
@ -480,10 +484,28 @@ bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
|
||||
sExt = fileName.substr(nExtPos);
|
||||
|
||||
std::transform(sExt.begin(), sExt.end(), sExt.begin(), tolower);
|
||||
|
||||
if (0 == sExt.compare(L".mht"))
|
||||
|
||||
if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;
|
||||
|
||||
if (bEmptyFile)
|
||||
{
|
||||
if (0 == sExt.compare(L".xlsx"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX;
|
||||
else if ( 0 == sExt.compare(L".docx"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX;
|
||||
else if (0 == sExt.compare(L".pptx"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX;
|
||||
|
||||
else if (0 == sExt.compare(L".ods"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS;
|
||||
else if (0 == sExt.compare(L".odt"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT;
|
||||
else if (0 == sExt.compare(L".odp"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP;
|
||||
}
|
||||
else if (0 == sExt.compare(L".mht"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
|
||||
else if (0 == sExt.compare(L".csv"))
|
||||
else if (0 == sExt.compare(L".csv") || 0 == sExt.compare(L".xlsx") || 0 == sExt.compare(L".xls"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
|
||||
else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
|
||||
nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
|
||||
|
||||
Reference in New Issue
Block a user