Skip to content

Fix drag-and-drop for sandboxed Flatpak apps (e.g., Telegram) - #54

Merged
nik012003 merged 1 commit into
nik012003:masterfrom
RoNiN-shadow:fix-flatpak-dnd
Apr 7, 2026
Merged

Fix drag-and-drop for sandboxed Flatpak apps (e.g., Telegram)#54
nik012003 merged 1 commit into
nik012003:masterfrom
RoNiN-shadow:fix-flatpak-dnd

Conversation

@RoNiN-shadow

Copy link
Copy Markdown
Contributor

Fixes #53

Description

This PR fixes an issue where dragging files into strictly sandboxed Flatpak applications (like Telegram) resulted in "File is empty" or "Permission denied" errors.

Changes Made:

  • Switched to native FileList: Replaced ContentProvider::for_bytes with ContentProvider::for_value(&FileList). This ensures that GTK correctly registers the dragged files with xdg-desktop-portal, granting the target Flatpak app the necessary read permissions.
  • Fixed URI parsing: File::for_uri in generate_content_provider. The function was receiving already-formatted URIs (like file:///...) from setup_drag_source_all.
  • Bumped GTK feature: Bumped the gtk4 feature flag in Cargo.toml from v4_6 to v4_8 to utilize the FileList::from_array method.

Tested locally on Arch Linux with Flatpak Telegram Desktop. Works flawlessly. Let me know if the v4_8 version bump is acceptable for the project's compatibility goals!

@nik012003

Copy link
Copy Markdown
Owner

Thank you for the PR, the changes look good!
v4.8 has been out for a few years now (it's the latest version in debian bookworm) so I'm perfectly fine with bumping it.
I will pull, do some testing and release it when I get back home.

@nik012003
nik012003 merged commit cbdccb7 into nik012003:master Apr 7, 2026
3 checks passed
@nik012003

Copy link
Copy Markdown
Owner

Merged and released in v0.4.12
Thanks for the good work!

@RoNiN-shadow
RoNiN-shadow deleted the fix-flatpak-dnd branch April 8, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does not work with Telegram flatpak - file is empty and cannot be sent

2 participants