From 6ddca0aa02a82fae8f0c5bce6b5db0b82a4556b4 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Wed, 8 Apr 2026 13:30:37 -0700 Subject: [PATCH] syntax: move URI regex outside ParseURI() --- atproto/syntax/uri.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/atproto/syntax/uri.go b/atproto/syntax/uri.go index fbf8807c..61165b25 100644 --- a/atproto/syntax/uri.go +++ b/atproto/syntax/uri.go @@ -5,6 +5,8 @@ import ( "regexp" ) +var uriRegex = regexp.MustCompile(`^[a-z][a-z.-]{0,80}:[[:graph:]]+$`) + // Represents an arbitrary URI in string format, as would pass Lexicon syntax validation. // // The syntax is minimal and permissive, designed for fast verification and exact-string passthrough, not schema-specific parsing or validation. For example, will not validate AT-URI or DID strings. @@ -19,7 +21,6 @@ func ParseURI(raw string) (URI, error) { if len(raw) > 8192 { return "", errors.New("URI is too long (8192 chars max)") } - var uriRegex = regexp.MustCompile(`^[a-z][a-z.-]{0,80}:[[:graph:]]+$`) if !uriRegex.MatchString(raw) { return "", errors.New("URI syntax didn't validate via regex") } -- 2.51.2