From ea46fc819964e5128dbd49962bbd049961af0509 Mon Sep 17 00:00:00 2001 From: jixiaoxu Date: Tue, 26 Apr 2022 10:25:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ehtml=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E5=86=85=E5=AE=B9=E8=A7=A3=E6=9E=90=E5=8F=8A?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/common.h | 3 ++- libsearch/file-utils.cpp | 4 ++++ libsearch/index/file-reader.cpp | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libsearch/common.h b/libsearch/common.h index dd245b0..8fd771f 100644 --- a/libsearch/common.h +++ b/libsearch/common.h @@ -38,7 +38,8 @@ static const QMap targetFileTypeMap = { {"pps", true}, {"dps", true}, {"et", true}, - {"pdf", true} + {"pdf", true}, + {"html", true} }; static const QMap targetPhotographTypeMap = { diff --git a/libsearch/file-utils.cpp b/libsearch/file-utils.cpp index 5d84e2f..981edf7 100644 --- a/libsearch/file-utils.cpp +++ b/libsearch/file-utils.cpp @@ -945,6 +945,10 @@ bool FileUtils::isEncrypedOrUnreadable(QString path) if(strsfx.endsWith("txt")) return false; return true; + } else if(name == "text/html") { + if(strsfx.endsWith("html")) + return false; + return true; } else if(type.inherits("application/msword") || type.name() == "application/x-ole-storage") { if(strsfx == "doc" || strsfx == "dot" || strsfx == "wps" || strsfx == "ppt" || strsfx == "pps" || strsfx == "dps" || strsfx == "et" || strsfx == "xls") { diff --git a/libsearch/index/file-reader.cpp b/libsearch/index/file-reader.cpp index 2b71d8f..d572f22 100644 --- a/libsearch/index/file-reader.cpp +++ b/libsearch/index/file-reader.cpp @@ -35,7 +35,7 @@ void FileReader::getTextContent(QString path, QString &textContent, QString &suf FileUtils::getPptxTextContent(path, textContent); } else if (suffix == "xlsx") { FileUtils::getXlsxTextContent(path, textContent); - } else if (suffix == "txt") { + } else if (strsfx == "txt" or strsfx == "html") { FileUtils::getTxtContent(path, textContent); } else if (suffix == "doc" || suffix == "dot" || suffix == "wps" || suffix == "ppt" || suffix == "pps" || suffix == "dps" || suffix == "et" || suffix == "xls") {