From 7941b3d4a1acce6d750ed9e74d9b1298d52f7270 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Mon, 9 Feb 2026 15:51:03 +0100 Subject: [PATCH] fix(linux): check for existing file before trying to install Under some circumstances it's possible that the user manages to select a directory instead of a kmp file, or manually enters a non-existing file. Is used to throw an error that we caught on Sentry; the user was able to continue to use the app. This change now checks for a valid file before trying to install the kmp file. Fixes: #15572 Fixes: KEYMAN-LINUX-99 --- .../keyman_config/view_installed.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/linux/keyman-config/keyman_config/view_installed.py b/linux/keyman-config/keyman_config/view_installed.py index c8416dfb62b..b2522605321 100755 --- a/linux/keyman-config/keyman_config/view_installed.py +++ b/linux/keyman-config/keyman_config/view_installed.py @@ -74,14 +74,18 @@ def on_installfile_clicked(self, button): filter_text.set_name(_("KMP files")) filter_text.add_pattern("*.kmp") dlg.add_filter(filter_text) - response = dlg.run() - if response != Gtk.ResponseType.OK: - dlg.destroy() - return - - file = dlg.get_filename() - dlg.destroy() - self.restart(self.install_file(file)) + while True: + response = dlg.run() + if response != Gtk.ResponseType.OK: + dlg.destroy() + return + + file = dlg.get_filename() + if file and os.path.isfile(file) and os.path.splitext(file)[1] == '.kmp': + dlg.destroy() + self.restart(self.install_file(file)) + return + # Loop until we have a valid file or the user cancels the dialog def install_file(self, kmpfile, language=None): installDlg = InstallKmpWindow(kmpfile, viewkmp=self, language=language)