Bug 475420

Summary: File with an extension in the name ignored when saving
Product: [Applications] krita Reporter: Manga Tengu <mangatengu>
Component: UsabilityAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: ghevan, halla
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: The pop up appearing to override user filename

Description Manga Tengu 2023-10-10 11:30:58 UTC
Created attachment 162183 [details]
The pop up appearing to override user filename

With version 5.3.0-prealpha (git f410665)
Up until something like 1 or 2 years ago, I could specify the file extension in the file name:
myPainting.png would be myPainting.png whatever the extension chosen in the combo box. So handy!

But since a certain change, if the combo box doesn’t match the file name, for example it’s kra…
it will only propose myPainting.kra or myPainting.png.kra, forcing me to cancel, take the time t select png in that painful combo box and save again.

I thought, maybe someone knows of some checkbox deep in the settings that would enable the old behavior ?

STEPS TO REPRODUCE
1. Open/create a file 
2. Open the save as dialog. if you open a jpg file, the combo box il already set on jpg. If you create a new file, it will be kra by default...
3. Enter a file name with an extension that does not match the original file (nor the combo box selection in the case of a new file so not kra). For example, save your file.jpg as `file.kra` or your new file as `file.png`

OBSERVED RESULT
(Attached a little screenshot)
A pop up asks you to remove your "unwanted" extension or to concatenate it with the extension in the combo box
so if you open `file.jpg` and try to save it as `file.kra` by just specifying the file name (combo box stays on jpg) you will be proposed to save as `file.jpg` or `file.kra.jpg`
And so on, if you have created a new file and try to save it as `file.png` you will be prompted to save it as `file.kra` or `file.png.kra`
Then you have to cancel, change the combo box value to match your file name input before saving.

EXPECTED RESULT
whatever the original file. If I set the file name as `filename.foo` the file is automatically saved in the `foo` format with the name `filename.foo` like it did 1 or 2 years ago... and hot coffee appears on the desk.

SOFTWARE/OS VERSIONS
macOS (changed version a lot since then...) same for the krita Qt etc versions.
A certainly useless detail: I'm on M1
Comment 1 Halla Rempt 2023-10-10 11:49:27 UTC
That's an OS dialog, not a Krita dialog. I haven't been update to the latest version of macos because my internet is broken and the temporary solution doesn't have enough data to update macOS. There might have been a change in the way macos reads the file handling capabilities of an application.
Comment 2 Halla Rempt 2023-10-10 11:52:18 UTC
Ah, also happens on my macbook pro Ventura. But this is how the system's file dialog works, apparently. You're no longer supposed to write the extension, but always have to get them from the dropdown. Ivan, I don't think we can do anything about that?
Comment 3 Manga Tengu 2023-10-10 14:19:48 UTC
by the way as you say it's linked to the native dialog, but there is a workaround: 
a solution was proposed to disable the use of native OS dialogs and use Qt's and it worked:
https://krita-artists.org/t/file-extension-choice-on-the-fly/75739/6?u=mangatengu
Comment 4 Halla Rempt 2023-10-10 15:38:28 UTC
That option is always available, fortunately :-). Given that we can't do much about this (but why doesn't the Pages native file dialog _not_ have the combobox with file types...) should we close this?
Comment 5 Manga Tengu 2023-10-10 15:51:22 UTC
Yes I will close this. (I guess I'm allowed ?)
Comment 6 Halla Rempt 2023-10-10 19:30:33 UTC
Yes, you are :-)
Comment 7 vanyossi 2023-10-12 19:52:42 UTC
The workaround is not available on sandboxed krita which makes me add this note:

This is the way macOS finder works, so there is nothing i'm aware atm taht we can do except set the default format to "all" to allow the user to set a file format using the extension. However for saving  krita defaults to .kra since we assume most people want to preserve all the file data to keep working on the file later. I'm not sure if Qt native dialog options allows to hide the combobox options and work as pages does.

Changing default file format to "all" might make more sense for the export option.