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