From fbfad24a65ba400a706dff3611e958866544d47c Mon Sep 17 00:00:00 2001 From: Chua Hou Date: Thu, 29 Jul 2021 21:10:35 +0800 Subject: [PATCH] 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. --- src/utils/screenshotsaver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/screenshotsaver.cpp b/src/utils/screenshotsaver.cpp index a2d20b29..d4c8a373 100644 --- a/src/utils/screenshotsaver.cpp +++ b/src/utils/screenshotsaver.cpp @@ -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 }