summaryrefslogtreecommitdiffstats
path: root/apps/workflowengine/src/components/Values/file.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/workflowengine/src/components/Values/file.js')
-rw-r--r--apps/workflowengine/src/components/Values/file.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/workflowengine/src/components/Values/file.js b/apps/workflowengine/src/components/Values/file.js
index 4a473dbc13c..fa6851cc5c2 100644
--- a/apps/workflowengine/src/components/Values/file.js
+++ b/apps/workflowengine/src/components/Values/file.js
@@ -40,6 +40,36 @@ const FileChecks = Object.values(OCA.WorkflowEngine.Plugins).map((plugin) => {
// new way of registering checks
+
+const validateRegex = function(string) {
+ var regexRegex = /^\/(.*)\/([gui]{0,3})$/
+ var result = regexRegex.exec(string)
+ return result !== null
+}
+
+FileChecks.push({
+ class: 'OCA\\WorkflowEngine\\Check\\FileName',
+ name: t('workflowengine', 'File name'),
+ operators: [
+ { operator: 'is', name: t('workflowengine', 'is') },
+ { operator: '!is', name: t('workflowengine', 'is not') },
+ { operator: 'matches', name: t('workflowengine', 'matches') },
+ { operator: '!matches', name: t('workflowengine', 'does not match') }
+ ],
+ placeholder: (check) => {
+ if (check.operator === 'matches' || check.operator === '!matches') {
+ return '/^dummy-.+$/i'
+ }
+ return 'filename.txt'
+ },
+ validate: (check) => {
+ if (check.operator === 'matches' || check.operator === '!matches') {
+ return validateRegex(check.value)
+ }
+ return true
+ }
+})
+
FileChecks.push({
class: 'OCA\\WorkflowEngine\\Check\\FileMimeType',
name: t('workflowengine', 'File MIME type'),