MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / LooksLikePatternFilePath

Function LooksLikePatternFilePath

internal/plugins/db/fsdb/patterns.go:70–75  ·  view source on GitHub ↗

LooksLikePatternFilePath reports whether loadPattern uses source as a filesystem path. HTTP handlers must reject these names to keep the CLI file-path feature out of the REST API.

(source string)

Source from the content-addressed store, hash-verified

68// filesystem path. HTTP handlers must reject these names to keep the
69// CLI file-path feature out of the REST API.
70func LooksLikePatternFilePath(source string) bool {
71 return strings.HasPrefix(source, "\\") ||
72 strings.HasPrefix(source, "/") ||
73 strings.HasPrefix(source, "~") ||
74 strings.HasPrefix(source, ".")
75}
76
77func (o *PatternsEntity) loadPattern(source string) (pattern *Pattern, err error) {
78 if LooksLikePatternFilePath(source) {

Callers 6

ValidateMethod · 0.92
rejectUnsafePatternNameFunction · 0.92
loadPatternMethod · 0.85
SaveMethod · 0.85
RenameMethod · 0.85

Calls

no outgoing calls

Tested by 1