Skip to content

Fix appending file extensions in KFileWidget

If a filename already ends in the default extension, don't append one automatically, else do (if checkbox is checked).

Test: Open a document in some application which uses the KFileWidget, e.g. LibreOffice Writer or Okular, then do "Save As" and make sure "Automatically select filename extension" is checked.

Enter a filename containing dots into the "Name" field, e.g. "a.b.c". Click "Save". Without this patch no valid extension will be appended, the filename will be "a.b.c". With the patch applied there will be a valid extension like ".odt" or ".pdf".

Enter a filename ending in ".odt" (LO Writer) or ".pdf" (Okular). No additional extension must be appended.

Bug: 431638

Edited by Robert Hoffmann

Merge request reports