Bug 105734 - xdg-open: prioritizes xdg_mime over $BROWSER
Summary: xdg-open: prioritizes xdg_mime over $BROWSER
Status: RESOLVED WONTFIX
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium enhancement
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-25 14:01 UTC by Marco Sirabella
Modified: 2018-05-10 14:52 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
fix (920 bytes, patch)
2018-03-25 14:01 UTC, Marco Sirabella
Details | Splinter Review

Description Marco Sirabella 2018-03-25 14:01:06 UTC
Created attachment 138345 [details] [review]
fix

Even if $BROWSER is set, still prioritizes `xdg-mime query default x-scheme-handler/<schemetype>`.

Version: 
```
$ xdg-open --version
xdg-open 1.1.2
```

Steps to Reproduce:

```
$ BROWSER=echo xdg-open "https://bugs.freedesktop.org/"
```

Actual Behavior:
opens given URL in default web browser (mine is firefox)

Expected Behavior:
run $BROWSER <url>, in this case `echo https://bugs.freedesktop.org/`

if $BROWSER not found, fallback to xdg-mime defaults


I've found a hackish workaround for the time being:

```
$ DISPLAY="" BROWSER=echo xdg-open "https://bugs.freedesktop.org/"
https://bugs.freedesktop.org/
```

I'm attaching a patch for the reordering of priorities to fix this

Thanks,
-- Marco Sirabella
Comment 1 Rex Dieter 2018-03-25 14:46:45 UTC
I think this is by design... The fallback to using a browser is only used as a last resort.
Comment 2 Marco Sirabella 2018-03-26 02:39:54 UTC
Looking over this, the request I've made would open any URL that is not a local file with the $BROWSER variable only if set. This is http, but also ftp & others.

I think it makes sense to prioritize a user-defined $BROWSER variable as the user has explicitly stated "I want to use this application(s) as my browser".
Comment 3 Rex Dieter 2018-05-10 14:52:51 UTC
$BROWSER is still legacy (and will possibly be removed from xdg-utils in a future iteration).  http/https related mimetypes are the modern equivalent to setting preferred browsers


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.