Fix pattern type matching

Amends 3c747aafa4

Pick-to: 6.3 6.2 5.15
Change-Id: I2753b627c269cbb50009ef5e9c2ffa274e0ccf5c
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Alex Richardson <arichardson.kde@gmail.com>
This commit is contained in:
Jarek Kobus 2021-12-28 10:30:52 +01:00
parent 61a136bf26
commit 9453038921

View File

@ -97,7 +97,7 @@ QMimeGlobPattern::PatternType QMimeGlobPattern::detectPatternType(const QString
if (!patternLength)
return OtherPattern;
const bool starCount = pattern.count(QLatin1Char('*')) == 1;
const int starCount = pattern.count(QLatin1Char('*'));
const bool hasSquareBracket = pattern.indexOf(QLatin1Char('[')) != -1;
const bool hasQuestionMark = pattern.indexOf(QLatin1Char('?')) != -1;
@ -109,10 +109,10 @@ QMimeGlobPattern::PatternType QMimeGlobPattern::detectPatternType(const QString
// Patterns like "README*" (well this is currently the only one like that...)
if (pattern.at(patternLength - 1) == QLatin1Char('*'))
return PrefixPattern;
}
// Names without any wildcards like "README"
if (starCount == 0)
} else if (starCount == 0) {
// Names without any wildcards like "README"
return LiteralPattern;
}
}
if (pattern == QLatin1String("[0-9][0-9][0-9].vdr"))