From b878bb42e6420992cfb904a7c0acd35118d3f65f Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Sun, 20 Jul 2014 19:39:15 +0530 Subject: [PATCH] Escape hash in attachment url, fix frappe/erpnext#1961 --- frappe/public/js/frappe/form/attachments.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/attachments.js b/frappe/public/js/frappe/form/attachments.js index c292416fa3..97255387a9 100644 --- a/frappe/public/js/frappe/form/attachments.js +++ b/frappe/public/js/frappe/form/attachments.js @@ -106,7 +106,8 @@ frappe.ui.form.Attachments = Class.extend({ file_url = '/files/' + attachment.file_name; } } - return encodeURI(file_url); + // hash is not escaped, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI + return encodeURI(file_url).replace('#', '%23'); }, remove_attachment_by_filename: function(filename, callback) { this.remove_attachment(this.get_attachments()[filename], callback);