|
|
@@ -76,6 +76,7 @@ class File(NestedSet): |
|
|
|
|
|
|
|
if frappe.db.exists('File', {'name': self.name, 'is_folder': 0}): |
|
|
|
if not self.is_folder and (self.is_private != self.db_get('is_private')): |
|
|
|
old_file_url = self.file_url |
|
|
|
private_files = frappe.get_site_path('private', 'files') |
|
|
|
public_files = frappe.get_site_path('public', 'files') |
|
|
|
|
|
|
@@ -91,6 +92,11 @@ class File(NestedSet): |
|
|
|
|
|
|
|
self.file_url = "/private/files/{0}".format(self.file_name) |
|
|
|
|
|
|
|
# update documents image url with new file url |
|
|
|
if self.attached_to_doctype and self.attached_to_name and \ |
|
|
|
frappe.db.get_value(self.attached_to_doctype, self.attached_to_name, "image") == old_file_url: |
|
|
|
frappe.db.set_value(self.attached_to_doctype, self.attached_to_name, "image", self.file_url) |
|
|
|
|
|
|
|
def set_folder_size(self): |
|
|
|
"""Set folder size if folder""" |
|
|
|
if self.is_folder and not self.is_new(): |
|
|
|