Skip to content

Commit

Permalink
fix: restrict mime type list depending on check operator
Browse files Browse the repository at this point in the history
fixes #23666

Signed-off-by: Robin Windey <[email protected]>
  • Loading branch information
R0Wi committed Jan 18, 2025
1 parent 307f983 commit 21d167a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion apps/workflowengine/src/components/Checks/FileMimeType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default {
},
computed: {
options() {
return [...this.predefinedTypes, this.customValue]
return ['is', '!is'].includes(this.check.operator) ? this.predefinedTypes : [this.customValue]
},
isPredefined() {
const matchingPredefined = this.predefinedTypes.find((type) => this.newValue === type.id)
Expand Down Expand Up @@ -108,6 +108,15 @@ export default {
}
},
},
watch: {
// If user changed operation from is/!is to matches/!matches (or vice versa), reset value
'check.operator'(newVal, oldVal) {
if ((['is', '!is'].includes(oldVal) && ['matches', '!matches'].includes(newVal))
|| (['matches', '!matches'].includes(oldVal) && ['is', '!is'].includes(newVal))) {
this.setValue(this.options[0])
}
},
},
methods: {
validateRegex(string) {
const regexRegex = /^\/(.*)\/([gui]{0,3})$/
Expand Down
4 changes: 2 additions & 2 deletions dist/workflowengine-workflowengine.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/workflowengine-workflowengine.js.map

Large diffs are not rendered by default.

0 comments on commit 21d167a

Please sign in to comment.