[minor] [fix] file manager saving issue with same file name

This commit is contained in:
Nabin Hait 2013-10-09 18:48:13 +05:30
parent 7c319b1084
commit 6d20bda182

View file

@ -96,9 +96,15 @@ def save_file(fname, content, dt, dn):
fpath = os.path.join(files_path, fname)
# rename
if os.path.exists(fpath.encode("utf-8")):
webnotes.throw("File already exists: " + fname)
os.rename(temp_fname, fpath.encode("utf-8"))
else:
# rename new file
if os.path.exists(fpath.encode("utf-8")):
webnotes.throw("File already exists: " + fname)
os.rename(temp_fname, fpath.encode("utf-8"))
f = webnotes.bean({