(fileType, filePath)
| 14 | // Checks if a file path is allowed by regexing the file name and expecting |
| 15 | // it not to match certain expressions. |
| 16 | const hasDisallowedFilePathPattern = (fileType, filePath) => { |
| 17 | for (const pattern of (GLOBAL_FILE_RULES[fileType] || {}).disallowed_file_patterns || []) { |
| 18 | if (filePath.match(new RegExp(pattern, 'i'))) { |
| 19 | return true; |
| 20 | } |
| 21 | } |
| 22 | return false; |
| 23 | }; |
| 24 | |
| 25 | // Checks if a file is of a particular type by regexing the file name and |
| 26 | // expecting a certain extension. |