Custom URL handler executes from wrong working directory

Bug #1841968 reported by BLuFeNiX
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Terminator
New
Undecided
Unassigned

Bug Description

The default URL handler is able to open files relative to the PWD. For example, Ctrl-clicking on a URL like "foo/bar.txt" will open the path `$(pwd)/foo/bar.txt` your preferred text editor. However, when using a custom URL handler the PWD will be the user's $HOME. This means that file with relatives paths cannot be opened by custom URL handlers because the PWD of the user's terminal session is not known from within the URL handler.

Proposed fixes:
1. Execute the custom URL handler from the terminal session's PWD
2. pass the terminal session's PWD as an argument or env variable to the custom URL handler

Revision history for this message
BLuFeNiX (pyronavi-gmail) wrote :

I have created a work-around for this. By modifying my URL handler plugin to prepend the terminal's CWD, we can pass the fully-qualified path to the custom URL handler. However, this requires that the end user maintains forks of all effected plugins, in the case that they want to use a custom URL handler.

```
  def callback(self, url):
    if not url.startswith("~") and not url.startswith("/"):
      for terminal in self.terminator.terminals:
        if terminal is self.terminator.last_focused_term:
          return terminal.get_cwd() + "/" + url
    else:
      return os.path.expanduser(url)
```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.