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