mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Use MIME type inheritance to find out if a file contains text
Before this commit, filenamesearch checked if a file's MIME type begins with "text/" to determine if its content can be searched. This prevented that text inside shell scripts is found. BUG: 332143 REVIEW: 116805 FIXED-IN: 4.12.4
This commit is contained in:
parent
c5d9791ad3
commit
d803ecec24
1 changed files with 4 additions and 1 deletions
|
@ -91,8 +91,11 @@ void FileNameSearchProtocol::searchDirectory(const KUrl& directory)
|
||||||
bool addItem = false;
|
bool addItem = false;
|
||||||
if (!m_regExp || item.name().contains(*m_regExp)) {
|
if (!m_regExp || item.name().contains(*m_regExp)) {
|
||||||
addItem = true;
|
addItem = true;
|
||||||
} else if (m_checkContent && item.mimetype().startsWith(QLatin1String("text/"))) {
|
} else if (m_checkContent && item.determineMimeType()->is(QLatin1String("text/plain"))) {
|
||||||
|
qDebug() << "### Checking" << item;
|
||||||
addItem = contentContainsPattern(item.url());
|
addItem = contentContainsPattern(item.url());
|
||||||
|
} else {
|
||||||
|
qDebug() << "### NOT Checking" << item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addItem) {
|
if (addItem) {
|
||||||
|
|
Loading…
Reference in a new issue