From ff9a6ff49159e0f6c26498aff4665e31739fa546 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Tue, 13 Jun 2023 16:57:42 +1200 Subject: [PATCH] API: Sort tags before saving Tags should be alphabetically sorted before saving. Whilst this was the behavior with automated tagging, it did not apply to manually set tags via the API. --- storage/tags.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/tags.go b/storage/tags.go index 4c47506..7b06407 100644 --- a/storage/tags.go +++ b/storage/tags.go @@ -22,6 +22,8 @@ func SetTags(id string, tags []string) error { } } + sort.Strings(applyTags) + tagJSON, err := json.Marshal(applyTags) if err != nil { logger.Log().Errorf("[db] setting tags for message %s", id)