Skip to content

The plugin link opener is broken for most use cases #2444

@dwomble

Description

@dwomble

I don't know whether to describe this as an enhancement or a bug.

The system for opening a link to a system/station etc. based on user preference is really great.

opener = plug.invoke(url, 'EDSM', 'system_url', monitor.state['SystemName'])
if opener:
    return webbrowser.open(opener)

However it's also completely broken by design because it ignores and overrides the system requested and instead opens the current system. The result is that I can't make any use of it at all and have to code my own version bypassing and duplicating the builtin solution.

def system_url(system_name: str) -> str:
    """
    Construct an appropriate EDSM URL for the provided system.

    :param system_name: Will be overridden with `this.system_address` if that
      is set.
    :return: The URL, empty if no data was available to construct it.
    """
    if this.system_address:
        return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemID64={this.system_address}')

    if system_name:
        return requests.utils.requote_uri(f'https://www.edsm.net/en/system?systemName={system_name}')

    return ''

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions