add hashtag to scope if absent

This commit is contained in:
Florent
2026-03-27 20:12:15 -04:00
parent 4c744888f1
commit fe5096eb9e
2 changed files with 3 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project] [project]
name = "meshcore" name = "meshcore"
version = "2.3.2" version = "2.3.3"
authors = [ authors = [
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, { name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
{ name="Alex Wolden", email="awolden@gmail.com" }, { name="Alex Wolden", email="awolden@gmail.com" },

View File

@@ -269,6 +269,8 @@ class MessagingCommands(CommandHandlerBase):
scope_key = b"\0"*16 scope_key = b"\0"*16
else: else:
logger.debug(f"Setting scope from string {scope}") logger.debug(f"Setting scope from string {scope}")
if scope[0] != "#": # no hashtag as first char
scope = "#" + scope # adding hashtag
scope_key = sha256(scope.encode("utf-8")).digest()[0:16] scope_key = sha256(scope.encode("utf-8")).digest()[0:16]
elif isinstance (scope, bytes): # scope has been sent directly as byte elif isinstance (scope, bytes): # scope has been sent directly as byte
logger.debug(f"Directly setting scope to {scope}") logger.debug(f"Directly setting scope to {scope}")