Fix save file name with '.'s in it (#1773)

Using QFileInfo::baseName() discards everything after the first ., so
filenames like 1.2.3.4.png would be changed to 1.png. (See #1722).

Changing this to QFileInfo::completeBaseName() only discards the suffix,
so we have 1.2.3.4.jpg becoming 1.2.3.4.png, for example.
This commit is contained in:
Chua Hou
2021-07-29 21:10:35 +08:00
committed by GitHub
parent 1031980ed1
commit fbfad24a65

View File

@@ -142,7 +142,7 @@ QString ScreenshotSaver::ShowSaveFileDialog(QWidget* parent,
dialog.selectedNameFilter().section('.', -1);
selectedExtension.remove(QChar(')'));
file_name =
info.path() + QLatin1String("/") + info.baseName() +
info.path() + QLatin1String("/") + info.completeBaseName() +
QLatin1String(".") +
selectedExtension; // recreate full filename with chosen suffix
}