fix: don't overwrite name for library files
name is used in many places and should not be overwritten, so i have sent name in upload_via_file_browser as library_file_name which can be used to get existing file.
This commit is contained in:
parent
0439e01ee7
commit
0c9efd3b5a
2 changed files with 8 additions and 5 deletions
|
|
@ -188,9 +188,12 @@ def upload_file():
|
|||
optimize = frappe.form_dict.optimize
|
||||
content = None
|
||||
|
||||
if frappe.form_dict.get("name", False):
|
||||
if frappe.form_dict.get("library_file_name", False):
|
||||
doc = frappe.get_value(
|
||||
"File", frappe.form_dict.name, ["is_private", "file_url", "file_name"], as_dict=True
|
||||
"File",
|
||||
frappe.form_dict.library_file_name,
|
||||
["is_private", "file_url", "file_name"],
|
||||
as_dict=True,
|
||||
)
|
||||
is_private = doc.is_private
|
||||
file_url = doc.file_url
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ function upload_via_file_browser() {
|
|||
}
|
||||
close_dialog.value = true;
|
||||
return upload_file({
|
||||
name: selected_file.value,
|
||||
library_file_name: selected_file.value,
|
||||
});
|
||||
}
|
||||
function upload_via_web_link() {
|
||||
|
|
@ -518,8 +518,8 @@ function upload_file(file, i) {
|
|||
if (file.file_name) {
|
||||
form_data.append('file_name', file.file_name);
|
||||
}
|
||||
if (file.name) {
|
||||
form_data.append('name', file.name);
|
||||
if (file.library_file_name) {
|
||||
form_data.append('library_file_name', file.library_file_name);
|
||||
}
|
||||
|
||||
if (props.doctype && props.docname) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue