Skip to content

Commit c6f52e1

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

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export default {
5353
type: String,
5454
default: '',
5555
},
56+
operator: {
57+
type: String,
58+
default: '',
59+
}
5660
},
5761
5862
emits: ['update:model-value'],
@@ -86,7 +90,7 @@ export default {
8690
},
8791
computed: {
8892
options() {
89-
return [...this.predefinedTypes, this.customValue]
93+
return ['is', '!is'].includes(this.operator) ? this.predefinedTypes : [this.customValue]
9094
},
9195
isPredefined() {
9296
const matchingPredefined = this.predefinedTypes.find((type) => this.newValue === type.id)
@@ -118,8 +122,14 @@ export default {
118122
modelValue() {
119123
this.updateInternalValue()
120124
},
125+
// If user changed operation from is/!is to matches/!matches (or vice versa), reset value
126+
operator(newVal, oldVal) {
127+
if ((['is', '!is'].includes(oldVal) && ['matches', '!matches'].includes(newVal))
128+
|| (['matches', '!matches'].includes(oldVal) && ['is', '!is'].includes(newVal))) {
129+
this.setValue(this.options[0])
130+
}
131+
},
121132
},
122-
123133
methods: {
124134
validateRegex(string) {
125135
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)