Browse Source

Merge pull request #14235 from surajshetty3416/fix-grid-upload-1

version-14
Suraj Shetty 3 years ago
committed by GitHub
parent
commit
9af24af213
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions
  1. +5
    -4
      frappe/public/js/frappe/form/grid.js
  2. +10
    -1
      frappe/public/js/frappe/utils/utils.js

+ 5
- 4
frappe/public/js/frappe/form/grid.js View File

@@ -835,10 +835,11 @@ export default class Grid {
$.each(row, (ci, value) => { $.each(row, (ci, value) => {
var fieldname = fieldnames[ci]; var fieldname = fieldnames[ci];
var df = frappe.meta.get_docfield(me.df.options, fieldname); var df = frappe.meta.get_docfield(me.df.options, fieldname);

d[fieldnames[ci]] = value_formatter_map[df.fieldtype]
? value_formatter_map[df.fieldtype](value)
: value;
if (df) {
d[fieldnames[ci]] = value_formatter_map[df.fieldtype]
? value_formatter_map[df.fieldtype](value)
: value;
}
}); });
} }
} }


+ 10
- 1
frappe/public/js/frappe/utils/utils.js View File

@@ -927,7 +927,16 @@ Object.assign(frappe.utils, {
// decodes base64 to string // decodes base64 to string
let parts = dataURI.split(','); let parts = dataURI.split(',');
const encoded_data = parts[1]; const encoded_data = parts[1];
return decodeURIComponent(escape(atob(encoded_data)));
let decoded = atob(encoded_data);
try {
const escaped = escape(decoded);
decoded = decodeURIComponent(escaped);

} catch (e) {
// pass decodeURIComponent failure
// just return atob response
}
return decoded;
}, },
copy_to_clipboard(string) { copy_to_clipboard(string) {
let input = $("<input>"); let input = $("<input>");


Loading…
Cancel
Save