MCPcopy
hub / github.com/wavetermdev/waveterm / ValidateAppId

Function ValidateAppId

pkg/waveappstore/waveappstore.go:60–78  ·  view source on GitHub ↗
(appId string)

Source from the content-addressed store, hash-verified

58}
59
60func ValidateAppId(appId string) error {
61 appNS, appName, err := ParseAppId(appId)
62 if err != nil {
63 return err
64 }
65 if len(appNS) > MaxNamespaceLen {
66 return fmt.Errorf("namespace too long: max %d characters", MaxNamespaceLen)
67 }
68 if len(appName) > MaxAppNameLen {
69 return fmt.Errorf("app name too long: max %d characters", MaxAppNameLen)
70 }
71 if !namespaceRegex.MatchString(appNS) {
72 return fmt.Errorf("invalid namespace: must match pattern @?[a-z0-9-]+")
73 }
74 if !appNameRegex.MatchString(appName) {
75 return fmt.Errorf("invalid app name: must match pattern [a-zA-Z0-9_-]+")
76 }
77 return nil
78}
79
80func GetAppDir(appId string) (string, error) {
81 if err := ValidateAppId(appId); err != nil {

Callers 15

GetAppDirFunction · 0.85
PublishDraftFunction · 0.85
RevertDraftFunction · 0.85
MakeDraftFromLocalFunction · 0.85
DeleteAppFunction · 0.85
WriteAppFileFunction · 0.85
ReadAppFileFunction · 0.85
DeleteAppFileFunction · 0.85
ReplaceInAppFileFunction · 0.85
ReplaceInAppFilePartialFunction · 0.85
RenameAppFileFunction · 0.85
FormatGoFileFunction · 0.85

Calls 1

ParseAppIdFunction · 0.85

Tested by

no test coverage detected