webbrowser-rs: Issue with Ubuntu 22.04, does not open web browser, instead opens mime-type file associated application.
I found this out by accident, when troubleshooting a problem with someone else’s application, but hey! I know what the issue is (Although, I do not know how to fix it, I can at least identify it!)
How to reproduce this issue:
gedit ~/.config/mimeapps.list
(you can use any text editor, really, I just chose gedit)
Once open, under [Default Applications]
replace the line containing text/html=
with text/html=gedit.desktop
If the line does not exist, add text/html=gedit.desktop
instead. (Again, any text editor with a .desktop
file will do.
Now that that’s set up, use the function that calls: open_browser_internal
, and is a standard file system path to an html document.
Example: /home/username/index.html
This will instead open up the file in the text editor you chose.
The problem is this: https://manpages.ubuntu.com/manpages/focal/man1/xdg-open.1.html
xdg-open opens a file or URL in the user’s preferred application. If a URL is provided the URL will be opened in the user’s preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.
This means that if a file path is provided rather than a URL, and is a valid mime type, it will open the related non-browser application instead. This is definitely an edge case, but hey, it didn’t open the default browser!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (9 by maintainers)
Thanks for this useful crate, looking forward to the next release. I’m sorry i couldn’t contribute by testing, the holiday season got me occupied. I will ensure to fix the directory bug and publish a new version as soon as you make the bug fixes into a release.