Fix setup of default file extension in Save as dialog
The default file extension was not setup correctly in all circumstances.
This change makes sure to extract the filetype from all known formats.
BUG: 421757
FIXED-IN: 5.0.9
(cherry picked from commit 5f7b325274c0535b68aca58819273e13e6a8d2b5)