mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-13 10:04:13 +02:00
55250a6de9
ProjectView::askUserForFilePath() only appended the .qet extension when FLATPAK_ID/SNAP_NAME were NOT set, on the assumption that the xdg-desktop-portal file dialog used by sandboxed Snap/Flatpak builds always appends the selected filter's extension itself (avoiding a double ".qet.qet"). In practice, on the reporter's Snap/Ubuntu 22.04 setup the portal dialog does not append it, so the environment-based skip left Save As producing a file with no extension at all. Portal behavior isn't something QET controls or can reliably detect via environment variables -- it depends on the desktop's actual portal implementation/version. Rather than guessing per-environment, normalize unconditionally: strip any existing .qet suffix (case-insensitive) and re-append exactly one. This produces the correct single extension whether or not the dialog already added it, on every environment. Verified: clean rebuild, only the intended object file recompiled and linked successfully. Wrote a standalone test of the normalization logic covering no-extension, already-has-extension, uppercase-extension, and a literal dot in the base filename -- all four produced exactly one correct ".qet" suffix with no double-extension and no missing extension. Not verified: the actual Snap-sandboxed portal dialog behavior itself, since building/running the Snap package and testing its file-save dialog under a portal is outside what's practical to set up in this sandbox. Confidence rests on the fix removing the environment-guessing entirely in favor of unconditional, dialog-implementation-agnostic normalization, which is correct regardless of what the underlying dialog does.