Custom URL handler executes from wrong working directory

Bug #1841968 reported by BLuFeNiX on 2019-08-29
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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

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
      return os.path.expanduser(url)

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

Other bug subscribers