[hotfix] Avoid overwriting of file if it exists
This commit is contained in:
parent
67e64f5707
commit
cc0ac7e4c0
1 changed files with 1 additions and 1 deletions
|
|
@ -224,7 +224,7 @@ def get_content_hash(content):
|
|||
|
||||
def get_file_name(fname, optional_suffix):
|
||||
n_records = frappe.db.sql("select name from `tabFile Data` where file_name='{}'".format(fname))
|
||||
if len(n_records) > 0:
|
||||
if len(n_records) > 0 or os.path.exists(get_files_path(fname)):
|
||||
partial, extn = fname.rsplit('.', 1)
|
||||
return '{partial}{suffix}.{extn}'.format(partial=partial, extn=extn, suffix=optional_suffix)
|
||||
return fname
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue