Skip to content

Commit 21d167a

Browse files
committed
fix: restrict mime type list depending on check operator
fixes #23666 Signed-off-by: Robin Windey <[email protected]>
1 parent 307f983 commit 21d167a

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

apps/workflowengine/src/components/Checks/FileMimeType.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default {
8080
},
8181
computed: {
8282
options() {
83-
return [...this.predefinedTypes, this.customValue]
83+
return ['is', '!is'].includes(this.check.operator) ? this.predefinedTypes : [this.customValue]
8484
},
8585
isPredefined() {
8686
const matchingPredefined = this.predefinedTypes.find((type) => this.newValue === type.id)
@@ -108,6 +108,15 @@ export default {
108108
}
109109
},
110110
},
111+
watch: {
112+
// If user changed operation from is/!is to matches/!matches (or vice versa), reset value
113+
'check.operator'(newVal, oldVal) {
114+
if ((['is', '!is'].includes(oldVal) && ['matches', '!matches'].includes(newVal))
115+
|| (['matches', '!matches'].includes(oldVal) && ['is', '!is'].includes(newVal))) {
116+
this.setValue(this.options[0])
117+
}
118+
},
119+
},
111120
methods: {
112121
validateRegex(string) {
113122
const regexRegex = /^\/(.*)\/([gui]{0,3})$/

dist/workflowengine-workflowengine.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/workflowengine-workflowengine.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)