761149e Screenshot: reject unknown image type filenames

Authored and Committed by jjongsma 6 years ago
    Screenshot: reject unknown image type filenames
    
    If the image format cannot be determined for a screenshot filename,
    simply return an error informing the user that this is not a valid image
    format.
    
    In the past, if we couldn't determine the file type, we simply saved it
    as a PNG, and appended a ".png" file extension to the filename. This has
    several problems. First, it can result in some oddly-named files (e.g. a
    screenshot named 'Screenshot.pdf.png').
    
    Second, modifying the filename that is returned from the GtkFileChooser
    undermines the overwrite-confirmation functionality that is built into
    the gtk file chooser. When the user specifies a filename in the file
    chooser dialog, the chooser will automatically check whether a file of
    that name exists, and if it does, it will display a dialog asking
    whether the user wants to overwrite it. But if we then append a ".png"
    extension to the filename and save it, we may be overwriting an existing
    file without warning. By returning an error for unrecognized file types,
    we avoid this problem.
    
    Resolves: rhbz#1455832
    
        
file modified
+3 -11