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

Function LooksLikePatternFilePath

internal/plugins/db/fsdb/patterns.go:61–66  ·  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

59// filesystem path. HTTP handlers must reject these names to keep the
60// CLI file-path feature out of the REST API.
61func LooksLikePatternFilePath(source string) bool {
62 return strings.HasPrefix(source, "\\") ||
63 strings.HasPrefix(source, "/") ||
64 strings.HasPrefix(source, "~") ||
65 strings.HasPrefix(source, ".")
66}
67
68func (o *PatternsEntity) loadPattern(source string) (pattern *Pattern, err error) {
69 if LooksLikePatternFilePath(source) {

Callers 5

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

Calls

no outgoing calls

Tested by 1