refactor CHORUS

This commit is contained in:
anthonyrawlins
2025-09-06 14:47:41 +10:00
parent 9bdcbe0447
commit b6634e4c1b
16 changed files with 225 additions and 225 deletions

View File

@@ -49,7 +49,7 @@ var (
pathPattern = regexp.MustCompile(`^/[a-zA-Z0-9\-_/\.]*$|^$`)
// Full URI pattern for validation
bzzzURIPattern = regexp.MustCompile(`^CHORUS://([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)@([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)(/[a-zA-Z0-9\-_/\.]*)?(\?[^#]*)?(\#.*)?$`)
chorusURIPattern = regexp.MustCompile(`^CHORUS://([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)@([a-zA-Z0-9\-_*]|any):([a-zA-Z0-9\-_*]|any)(/[a-zA-Z0-9\-_/\.]*)?(\?[^#]*)?(\#.*)?$`)
)
// ParseBzzzURI parses a CHORUS:// URI string into a BzzzURI struct
@@ -104,7 +104,7 @@ func ParseBzzzURI(uri string) (*BzzzURI, error) {
task := parts[1]
// Create BzzzURI instance
bzzzURI := &BzzzURI{
chorusURI := &BzzzURI{
Agent: agent,
Role: role,
Project: project,
@@ -116,11 +116,11 @@ func ParseBzzzURI(uri string) (*BzzzURI, error) {
}
// Validate components
if err := bzzzURI.Validate(); err != nil {
if err := chorusURI.Validate(); err != nil {
return nil, fmt.Errorf("validation failed: %w", err)
}
return bzzzURI, nil
return chorusURI, nil
}
// Validate validates all components of the BzzzURI
@@ -298,7 +298,7 @@ func ValidateBzzzURIString(uri string) error {
return fmt.Errorf("empty URI")
}
if !bzzzURIPattern.MatchString(uri) {
if !chorusURIPattern.MatchString(uri) {
return fmt.Errorf("invalid CHORUS:// URI format")
}