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