## Summary
Downloads in Chromium-based browsers (Brave Origin) are saved with only the file's extension (e.g. `~/Downloads/.rpm`) instead of the proper basename (e.g. `Moonfin_Linux_v2.5.1.rpm`). The full filename is requested by the browser and received by the portal, but the save dialog displayed by the **GNOME/Nautilus portal backend** strips the basename and shows only the extension. Routing the file chooser to the **GTK portal backend** fixes it.
## Environment
- OS: RakuOS (Fedora 44 immutable base, ostree overlay)
- Session: Niri (`XDG_CURRENT_DESKTOP=niri`, Wayland)
- Browser: Brave Origin 153.1.95.104 (Chromium 153.0.8010.53), package `brave-origin`
- Portal packages:
- xdg-desktop-portal 1.22.1-1.fc44
- xdg-desktop-portal-gtk 1.15.3-3.fc44
- xdg-desktop-portal-gnome 50.0-1.fc44
- System portal config: `/usr/share/xdg-desktop-portal/niri-portals.conf` with `default=gnome;gtk;` (no per-interface override), so `FileChooser` routes to the GNOME backend, which in turn delegates to `org.gnome.Nautilus`'s portal `FileChooser` implementation.
## Steps to reproduce
1. In Brave, download a file whose server response includes `Content-Disposition: attachment; filename=<name>.rpm` (e.g. a GitHub release asset).
2. In the resulting native save dialog, observe the filename field shows only `.rpm` (the basename is missing). Saving writes the file as (e.g.) `/var/home/guru/Downloads/.rpm`. If saving again, the portal adds an overwrite dedup suffix such as `(1)` → `(1).rpm`.
## Diagnosis performed
1. **Chromium download internals (correct):** The History DB record for the download showed `target_path = /var/home/guru/Downloads/.rpm` with `state=1` (complete), `mime_type=application/x-rpm`, `original_mime_type=application/octet-stream`.
2. **Server headers (correct):** `curl -L` confirmed the final response carries `content-disposition: attachment; filename=Moonfin_Linux_v2.5.1.rpm`.
3. **Headless reproductions (correct):** Headless Chromium with a temp profile and CDP (both `Page.setDownloadBehavior` and `Browser.setDownloadBehavior`) saved the files with the correct basename — including through a 302 redirect and with the real profile (extensions active). This isolated the bug away from the browser.
4. **D-Bus portal trace (finds the culprit):** Monitoring `org.freedesktop.impl.portal.FileChooser#SaveFile` while saving showed the request carried the **correct** name and folder:
- `current_name = "Moonfin_Linux_v2.5.1 (1).rpm"`
- `current_folder = /var/home/guru/Downloads`
- filters: `*.rpm` and `All Files`
The request chain was: Brave → `org.freedesktop.portal.Desktop` (frontend) → `org.freedesktop.impl.portal.desktop.gnome` → `org.gnome.Nautilus` (FileChooser backend).
5. **Conclusion:** Brave sends the correct `current_name`, but the GNOME/Nautilus portal FileChooser backend drops the basename and shows/suggests only the extension. This is the root cause; it affects any app using the portal save dialog, not just Brave.
## Workaround (applies, verified)
Force the FileChooser portal to the GTK backend via a user-level override:
```ini
# ~/.config/xdg-desktop-portal/niri-portals.conf
[preferred]
org.freedesktop.impl.portal.FileChooser=gtk
```
Restart the portal:
```
systemctl --user restart xdg-desktop-portal.service
```
Verification that the override is active (from `xdg-desktop-portal --replace --verbose`):
```
XDP: Preferred portals for interface 'org.freedesktop.impl.portal.FileChooser': gtk
```
After the change the same download saves as `Moonfin_Linux_v2.5.1.rpm`, and the D-Bus trace no longer shows Nautilus handling the dialog.
Note: the same issue class exists upstream (e.g. the GNOME FileChooser portal mis-handling of `current_name` alongside an active file filter), so this override only affects the reporting desktop. It is a stopgap, not a fix for the backend.
## Requested upstream action
1. Reproduce: have the GNOME/Nautilus portal FileChooser backend honor `current_name` when a file filter with a single suffix is active — do not strip the basename to the extension in the displayed/suggested filename.
2. Consider shipping `org.freedesktop.impl.portal.FileChooser=gtk` in the RakuOS-provided `niri-portals.conf` (or a per-desktop override) until the GNOME backend is corrected, so users are not affected out of the box.
## Attachments / logs
- D-Bus `dbus-monitor` output of the `SaveFile` request showing correct `current_name`/`current_folder` (captured during reproduction).
- `xdg-desktop-portal --replace --verbose` output showing `FileChooser=gtk` after the override and `FileChooser=gnome` before.
- Test server used for reproduction endpoints (`/simple`, `/multidot`, `/safename`, `/redirect`, `/cdattach`) serving controlled `Content-Disposition` filenames.
## Privacy
No privacy-sensitive data is included in this report. The reproduction uses synthetic test-server filenames (`Moonfin_Linux_v2.5.1.rpm`, `SimpleFileName.rpm`, `Target_Name_v9.bin`) and local-only resources; no real user files, browsing history, or credentials were referenced or captured.