From 421fe6959ed0a1039dffc19ede8246416b16a2f0 Mon Sep 17 00:00:00 2001 From: Hugo Delaunay Date: Fri, 15 Dec 2023 18:40:02 +0100 Subject: [PATCH] chore(platform_interface): Attributes keys are no longer limited to 9 characters by default. Closes #74. --- .../lib/src/service/normalizer.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bonsoir_platform_interface/lib/src/service/normalizer.dart b/packages/bonsoir_platform_interface/lib/src/service/normalizer.dart index fef32717..04147a3a 100644 --- a/packages/bonsoir_platform_interface/lib/src/service/normalizer.dart +++ b/packages/bonsoir_platform_interface/lib/src/service/normalizer.dart @@ -77,7 +77,7 @@ class BonsoirServiceNormalizer { /// Normalizes a given service [attributes]. /// /// Reference : [RFC 6763](https://datatracker.ietf.org/doc/html/rfc6763#section-6). - static Map normalizeAttributes(Map attributes) { + static Map normalizeAttributes(Map attributes, { bool limitKeyLength = false }) { Map result = {}; for (MapEntry entry in attributes.entries) { @@ -87,7 +87,7 @@ class BonsoirServiceNormalizer { key = key.replaceAll('=', ''); // The key SHOULD be no more than nine characters long. - if (key.length >= 9) { + if (limitKeyLength && key.length >= 9) { key = key.substring(0, 9); }