From 47ab1c1b03be8aa7d47e9a4076c7464f9c65969f Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Tue, 5 Sep 2017 14:18:38 +0530 Subject: [PATCH 1/3] [SETUP] Fixed file_url fetch for profile image --- frappe/public/js/frappe/form/controls/attach.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/attach.js b/frappe/public/js/frappe/form/controls/attach.js index 29aec4d05d..e48df4ebc2 100644 --- a/frappe/public/js/frappe/form/controls/attach.js +++ b/frappe/public/js/frappe/form/controls/attach.js @@ -169,7 +169,18 @@ frappe.ui.form.ControlAttach = frappe.ui.form.ControlData.extend({ if(this.frm) { return this.value; } else { - return this.fileobj ? (this.fileobj.filename + "," + this.dataurl) : null; + // return this.fileobj ? (this.fileobj.filename + "," + this.dataurl) : null; + if ( this.fileobj ) { + if ( this.fileobj.file_url ) { + return this.fileobj.file_url; + } else if ( this.fileobj.filename ) { + var dataURI = this.fileobj.filename + ',' + this.dataurl; + + return dataURI; + } + } + + return null } }, From 833f235869401d227074c6d836fcd63d96e68b9c Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Tue, 5 Sep 2017 14:20:12 +0530 Subject: [PATCH 2/3] removed comments --- frappe/public/js/frappe/form/controls/attach.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/attach.js b/frappe/public/js/frappe/form/controls/attach.js index e48df4ebc2..60257881b9 100644 --- a/frappe/public/js/frappe/form/controls/attach.js +++ b/frappe/public/js/frappe/form/controls/attach.js @@ -169,7 +169,6 @@ frappe.ui.form.ControlAttach = frappe.ui.form.ControlData.extend({ if(this.frm) { return this.value; } else { - // return this.fileobj ? (this.fileobj.filename + "," + this.dataurl) : null; if ( this.fileobj ) { if ( this.fileobj.file_url ) { return this.fileobj.file_url; From 4bef4242924cc16b0ee729ada4c0cb3d8bb684df Mon Sep 17 00:00:00 2001 From: Achilles Rasquinha Date: Tue, 5 Sep 2017 15:08:07 +0530 Subject: [PATCH 3/3] fixed codacy lint --- frappe/public/js/frappe/form/controls/attach.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/attach.js b/frappe/public/js/frappe/form/controls/attach.js index 60257881b9..0efd76dd13 100644 --- a/frappe/public/js/frappe/form/controls/attach.js +++ b/frappe/public/js/frappe/form/controls/attach.js @@ -179,7 +179,7 @@ frappe.ui.form.ControlAttach = frappe.ui.form.ControlData.extend({ } } - return null + return null; } },