Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check if rule name already exists in /autolink add command #212

Open
dmarushkin opened this issue Apr 5, 2023 · 1 comment
Open

Comments

@dmarushkin
Copy link

Thare are no checks if Name already exists in function executeAdd:

server/autolinkplugin/command.go:
`
func executeAdd(p *Plugin, c *plugin.Context, header *model.CommandArgs, args ...string) *model.CommandResponse {
if len(args) > 1 {
return responsef(helpText)
}
name := ""
if len(args) == 1 {
name = args[0]
}

err := saveConfigLinks(p, append(p.getConfig().Links, autolink.Autolink{
	Name: name,
}))
if err != nil {
	return responsef(err.Error())
}

if name == "" {
	return executeList(p, c, header)
}
return executeList(p, c, header, name)

}
`

After adding second rule with the same name we can't change prev or new rule or even delete new one. Instead we got this message:

"Visa" matched more than one link: ["Visa" "Visa"]

So we can fix that by checking name in existing rules.

@dmarushkin dmarushkin changed the title Add check if rule name allready exists Add check if rule name already exists Apr 5, 2023
@dmarushkin dmarushkin changed the title Add check if rule name already exists Add check if rule name already exists in /autolink add command Apr 5, 2023
@bradwood
Copy link

bradwood commented Aug 6, 2024

I have fallen foul of this bug too and, what makes it annoying is if you try to delete the duplicates with a slash-command you cannot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants