refactor CHORUS
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user