From d2d73d5aac05a2f3f9671463055cd73fb03dccea Mon Sep 17 00:00:00 2001 From: Oscar <5xp395ab@duck.com> Date: Tue, 10 Oct 2023 12:40:47 +0000 Subject: [PATCH] fix: only allow image files to be used as background sem-ver: bug-fix Signed-off-by: Oscar <5xp395ab@duck.com> --- guake/prefs.py | 11 ++++++++++- ..._nonimage_file_as_background-46a5d468eb91b33c.yaml | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/prevent_nonimage_file_as_background-46a5d468eb91b33c.yaml diff --git a/guake/prefs.py b/guake/prefs.py index 1ecc3a56e..9452c64c7 100644 --- a/guake/prefs.py +++ b/guake/prefs.py @@ -536,8 +536,17 @@ def on_font_style_font_set(self, fbtn): self.settings.styleFont.set_string("style", fbtn.get_font_name()) def on_background_image_file_chooser_file_changed(self, fc): + allowed_extensions = ( + ".jpg", + ".jpeg", + ".png", + ".gif", + ) # only allow files with these extensions self.settings.general.set_string( - "background-image-file", fc.get_filename() if fc.get_filename() else "" + "background-image-file", + fc.get_filename() + if fc.get_filename() and fc.get_filename().endswith(allowed_extensions) + else "", ) def on_background_image_file_remove_clicked(self, btn): diff --git a/releasenotes/notes/prevent_nonimage_file_as_background-46a5d468eb91b33c.yaml b/releasenotes/notes/prevent_nonimage_file_as_background-46a5d468eb91b33c.yaml new file mode 100644 index 000000000..789614c3c --- /dev/null +++ b/releasenotes/notes/prevent_nonimage_file_as_background-46a5d468eb91b33c.yaml @@ -0,0 +1,7 @@ +release_summary: > + Prevent the use of non-image files as the background image. The following file extensions are allowed: .jpg, .jpeg, .png, .gif + +fixes: + - | + + - Prevent users from setting non-image files as a background image, closes #2205