Skip to content

Commit

Permalink
Gui: Correct repeated extension
Browse files Browse the repository at this point in the history
  • Loading branch information
chennes authored and WandererFan committed Aug 19, 2024
1 parent 0b8c8ce commit 8913b84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Gui/FileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption,
}

QRegularExpression rx;
rx.setPattern(QLatin1String(R"(\s(\(\*\.\w{1,})\W)"));
rx.setPattern(QLatin1String(R"(\s\((\*\.\w{1,})\W)"));
QStringList possibleSuffixes;
getPossibleSuffixes(possibleSuffixes, rx, filterToSearch);
auto match = rx.match(*filterToSearch);
Expand All @@ -207,7 +207,8 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption,
int offsetStart = 3;
int offsetEnd = 4;
QString suffix = filterToSearch->mid(index + offsetStart, length - offsetEnd);
if (fi.suffix().isEmpty() || !possibleSuffixes.contains(fi.suffix())) {
QString fiSuffix = QLatin1String("*.") + fi.suffix(); // To match with possibleSuffixes
if (fi.suffix().isEmpty() || !possibleSuffixes.contains(fiSuffix)) {
dirName += suffix;
}
}
Expand Down

0 comments on commit 8913b84

Please sign in to comment.