mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-14 07:55:03 -05:00
check extension names don't have spoaces
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
@@ -118,9 +119,13 @@ func (r *ExtensionRegistry) Register(configPath string) error {
|
||||
return fmt.Errorf("failed to parse config file: %w", err)
|
||||
}
|
||||
|
||||
// Add validation
|
||||
if err := r.validateExtensionDefinition(&ext); err != nil {
|
||||
return fmt.Errorf("invalid extension configuration: %w", err)
|
||||
// Validate extension name
|
||||
if ext.Name == "" {
|
||||
return fmt.Errorf("extension name cannot be empty")
|
||||
}
|
||||
|
||||
if strings.Contains(ext.Name, " ") {
|
||||
return fmt.Errorf("extension name '%s' contains spaces - names must not contain spaces", ext.Name)
|
||||
}
|
||||
|
||||
// Verify executable exists
|
||||
|
||||
@@ -15,18 +15,18 @@ var (
|
||||
fetchPlugin = &FetchPlugin{}
|
||||
sysPlugin = &SysPlugin{}
|
||||
extensionManager *ExtensionManager
|
||||
Debug = true // Debug flag
|
||||
Debug = false // Debug flag
|
||||
)
|
||||
|
||||
|
||||
func init() {
|
||||
homedir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
// We should probably handle this error appropriately
|
||||
return
|
||||
debugf("Warning: could not initialize extension manager: %v\n", err)
|
||||
}
|
||||
configDir := filepath.Join(homedir, ".config/fabric")
|
||||
extensionManager = NewExtensionManager(configDir)
|
||||
// Extensions will work if registry exists, otherwise they'll just fail gracefully
|
||||
}
|
||||
|
||||
var pluginPattern = regexp.MustCompile(`\{\{plugin:([^:]+):([^:]+)(?::([^}]+))?\}\}`)
|
||||
|
||||
Reference in New Issue
Block a user