Skip to content

Commit e9265a7

Browse files
committed
agent: allow all-digit names
1 parent 7682999 commit e9265a7

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/Simplex/Messaging/Agent/Protocol.hs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ module Simplex.Messaging.Agent.Protocol
189189
where
190190

191191
import Control.Applicative (optional, (<|>))
192-
import Control.Monad
193192
import Control.Exception (BlockedIndefinitelyOnMVar (..), BlockedIndefinitelyOnSTM (..), fromException)
194193
import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), (.:), (.:?))
195194
import qualified Data.Aeson as J'
@@ -1547,10 +1546,7 @@ instance StrEncoding SimplexNameInfo where
15471546
where
15481547
nameP nt = parseName nt . safeDecodeUtf8 <$?> A.takeWhile1 (not . A.isSpace)
15491548
parseName nt s = AT.parseOnly (nameLabelP `AT.sepBy1` AT.char '.' <* AT.endOfInput) s >>= mkNameInfo nt
1550-
nameLabelP = do
1551-
ws <- AT.takeWhile1 (\c -> isNameLetter c || isDigit c) `AT.sepBy1` AT.char '-'
1552-
when (all (T.all isDigit) ws) $ fail "name must contain letters"
1553-
pure $ T.intercalate "-" ws
1549+
nameLabelP = T.intercalate "-" <$> AT.takeWhile1 (\c -> isNameLetter c || isDigit c) `AT.sepBy1` AT.char '-'
15541550
isNameLetter c = isAlpha c && not (c >= '\x00c0' && c <= '\x024f')
15551551
mkNameInfo nt labels = case reverse labels of
15561552
[] -> Left "empty name"

0 commit comments

Comments
 (0)