(source string)
| 66 | } |
| 67 | |
| 68 | func (o *PatternsEntity) loadPattern(source string) (pattern *Pattern, err error) { |
| 69 | if LooksLikePatternFilePath(source) { |
| 70 | // Resolve the file path using GetAbsolutePath |
| 71 | var absPath string |
| 72 | if absPath, err = util.GetAbsolutePath(source); err != nil { |
| 73 | return nil, fmt.Errorf(i18n.T("patterns_error_resolve_file_path"), err) |
| 74 | } |
| 75 | |
| 76 | // Use the resolved absolute path to get the pattern |
| 77 | if pattern, err = o.getFromFile(absPath); err != nil { |
| 78 | return nil, fmt.Errorf(i18n.T("patterns_error_load_from_file"), absPath, err) |
| 79 | } |
| 80 | } else { |
| 81 | // Otherwise, get the pattern from the database |
| 82 | pattern, err = o.getFromDB(source) |
| 83 | } |
| 84 | |
| 85 | return |
| 86 | } |
| 87 | |
| 88 | func (o *PatternsEntity) ensureInput(pattern *Pattern) { |
| 89 | if !strings.Contains(pattern.Pattern, "{{input}}") { |
no test coverage detected