Skip to content

Commit 5a6a423

Browse files
authored
Merge pull request #6925 from ProcessMaker/bugfix/FOUR-16559
Bugfix/FOUR-16559: When I Quick-Fill a task, the signature is also filled and it is observed by the audit.
2 parents 45f083f + d4887fa commit 5a6a423

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎resources/js/tasks/components/QuickFillPreview.vue‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,18 @@ export default {
269269
}
270270
this.$emit("close");
271271
},
272+
validateBase64(field) {
273+
const regex = /^data:image\/\w+;base64,/;
274+
return regex.test(field);
275+
},
272276
buttonThisDataFromFullTask(quickFillData) {
273277
// If the task does not have a draft yet, use the task data
274278
const dataToUse = this.task.draft?.data ?? this.task.data;
275279
276280
const draftData = {};
277281
this.screenFields.forEach((field) => {
278282
const existingValue = _.get(dataToUse, field, null);
283+
279284
let quickFillValue;
280285
if (existingValue) {
281286
// If the value exists in the task data (or task draft data), don't overwrite it
@@ -284,6 +289,11 @@ export default {
284289
// use the value from the quick fill
285290
quickFillValue = _.get(quickFillData, field, null);
286291
}
292+
293+
if(this.validateBase64(quickFillValue)) {
294+
_.set(draftData, field, existingValue);
295+
return;
296+
}
287297
// Set the value. This handles nested values using dot notation in 'field' string
288298
_.set(draftData, field, quickFillValue);
289299
});

‎resources/views/tasks/preview.blade.php‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ class="card border-0"
428428
this.sendEvent('taskReady', this.task?.id);
429429
});
430430
},
431+
validateBase64(field) {
432+
const regex = /^data:image\/\w+;base64,/;
433+
return regex.test(field);
434+
},
431435
},
432436
mounted() {
433437
this.prepareData();
@@ -441,6 +445,7 @@ class="card border-0"
441445
screenFields.forEach((field) => {
442446
443447
const existingValue = _.get(this.formData, field, null);
448+
444449
let quickFillValue;
445450
446451
if (existingValue) {
@@ -450,8 +455,14 @@ class="card border-0"
450455
// use the value from the quick fill(event.detail)
451456
quickFillValue = _.get(event.detail, field, null);
452457
}
458+
459+
if(this.validateBase64(quickFillValue)) {
460+
_.set(newData, field, existingValue);
461+
return;
462+
}
453463
// Set the value. This handles nested values using dot notation in 'field' string
454464
_.set(newData, field, quickFillValue);
465+
455466
});
456467
457468
this.formData = newData;
@@ -461,6 +472,14 @@ class="card border-0"
461472
// want to use all data saved in the inbox rule db record, regardless
462473
// if the field exists or not.
463474
window.addEventListener('fillDataOverwriteExistingFields', event => {
475+
for (let key in event.detail) {
476+
if (event.detail.hasOwnProperty(key)) {
477+
let value = event.detail[key];
478+
if (this.validateBase64(value)) {
479+
delete event.detail[key];
480+
}
481+
}
482+
}
464483
this.formData = _.merge(_.cloneDeep(this.formData), event.detail);
465484
});
466485

0 commit comments

Comments
 (0)