mattermost-community / mattermost-plugin-autolink

Automatically rewrite text matching a regular expression into a markdown link.
Apache License 2.0
132 stars 57 forks source link

Autolink list displays varying versions of patterns. #97

Open dschaper opened 4 years ago

dschaper commented 4 years ago

Autolink seems to be converting < and >s to unicode escape chars. This ends up causing the /autolink list to show erroneous information.

Autolink v1.1.2 Mattermost Version: 5.20.1 Database Schema Version: 5.20.0 Database: postgres

autolink set CoreChannel Pattern (?i)(#)(?P<Gh_id>\d+)

/autolink list: Screenshot_2020-03-06 (5) Dan Schaper - Pi-hole Pi-hole Team Mattermost

/autolink list CoreChannel Screenshot_2020-03-06 (5) Dan Schaper - Pi-hole Pi-hole Team Mattermost(1)

config.json

            "mattermost-autolink": {
                "enableadmincommand": true,
                "links": [
                    {
                        "DisableNonWordPrefix": false,
                        "DisableNonWordSuffix": false,
                        "Disabled": false,
                        "Name": "CoreChannel",
                        "Pattern": "(?i)(#)(?P\u003cGh_id\u003e\\d+)",
                        "Scope": [
                            "pi-hole/pihole-repo"
                        ],
                        "Template": "[Core #${GH_id}](https://github.com/pi-hole/pi-hole/issues/${GH_id})",
                        "WordMatch": false
                    },
                    {
                        "DisableNonWordPrefix": false,
                        "DisableNonWordSuffix": false,
                        "Disabled": false,
                        "Name": "GitHubCore",
                        "Pattern": "(?i)(core)(-| #| )(?P\u003cGH_id\u003e\\d+)",
                        "Scope": null,
                        "Template": "[Core #${GH_id}](https://github.com/pi-hole/pi-hole/issues/${GH_id})",
                        "WordMatch": false
                    },
                    {
                        "DisableNonWordPrefix": false,
                        "DisableNonWordSuffix": false,
                        "Disabled": false,
                        "Name": "GitHubFTL",
                        "Pattern": "(?i)(ftl)((-| #))(?P\u003cGH_id\u003e\\d+)",
                        "Scope": null,
                        "Template": "[FTL #${GH_id}](https://github.com/pi-hole/ftl/issues/${GH_id})",
                        "WordMatch": false
                    },
                    {
                        "DisableNonWordPrefix": false,
                        "DisableNonWordSuffix": false,
                        "Disabled": false,
                        "Name": "GitHubPRorIssue",
                        "Pattern": "https://github\\.com/pi-hole/(?P\u003crepo\u003e.+)/(?P\u003ctype\u003e.+)/(?P\u003cid\u003e\\d+)",
                        "Scope": null,
                        "Template": "[${type}: pi-hole/${repo} #${id}](https://github.com/pi-hole/${repo}/${type}/${id})",
                        "WordMatch": false
                    }
                ]
            }
        },
hanzei commented 4 years ago

@dschaper Can you confirm that this also happens with v1.2.1?

dschaper commented 4 years ago

Yes, this still is occurring.