From 612c279444a5f8ada97c57e092e892a4a2ff7ea6 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 4 May 2023 12:35:48 +0200 Subject: [PATCH] fix(systemtags): sort tags on dav response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/dav/lib/SystemTag/SystemTagList.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/dav/lib/SystemTag/SystemTagList.php b/apps/dav/lib/SystemTag/SystemTagList.php index 678c8042a394b..15bea95104bfd 100644 --- a/apps/dav/lib/SystemTag/SystemTagList.php +++ b/apps/dav/lib/SystemTag/SystemTagList.php @@ -58,6 +58,11 @@ public static function xmlDeserialize(Reader $reader): void { } public function xmlSerialize(Writer $writer): void { + // Sort the tags by name + usort($this->tags, function($tag1, $tag2) { + return strnatcmp($tag1->getName(), $tag2->getName()); + }); + foreach ($this->tags as $tag) { $writer->startElement('{' . self::NS_NEXTCLOUD . '}system-tag'); $writer->writeAttributes([