Skip to content

Commit a9f8c0e

Browse files
committed
fix: add autofill for columns with foreignResource and remove BOM-symbols from strings before encoding
1 parent ea5cc67 commit a9f8c0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

custom/CloneRowButton.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,17 @@ function redirectToCreatePage() {
3535
const fieldsToFill = { ...props.resource.columns.filter((col: any) => col.showIn.create === true) }
3636
let dataToFill = {};
3737
for (const field of Object.values(fieldsToFill)) {
38+
if (field.foreignResource) {
39+
dataToFill[field.name] = props.record[field.name]?.pk
40+
continue;
41+
}
3842
dataToFill[field.name] = props.record[field.name];
3943
}
4044
return dataToFill;
4145
}
4246
4347
function save_btoa(str) {
44-
return btoa(str);
48+
const cleaned = str.replace(/\uFEFF/g, '');
49+
return btoa(cleaned);
4550
}
4651
</script>

0 commit comments

Comments
 (0)