From 654387ff05e84c51a4c85854abe1843bb65ed412 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind1991@gmail.com>
Date: Sun, 12 Dec 2010 22:34:17 +0100
Subject: [PATCH] Show error when trying to create a file or folder that
 already exists

fixes https://bugs.kde.org/show_bug.cgi?id=259616
---
 js/lib_files.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/js/lib_files.js b/js/lib_files.js
index 8f7f9035585..54af643272a 100644
--- a/js/lib_files.js
+++ b/js/lib_files.js
@@ -225,6 +225,10 @@ OC_FILES.newFile=function(type,name,dir){
 	arg=new Object;
 	arg.name=name;
 	arg.dir=dir;
+	if(OC_FILES.cache.files[name]){//check if the file already exists
+		alert(((type=='dir')?'folder ':'file ')+name+' already exists.');
+		return;
+	}
 	arg.type=type;
 	OC_API.run('new',{dir:dir,name:name,type:type},OC_FILES.new_callback,arg)
 	if(!OC_FILES.cache.incomplete[dir]){
-- 
GitLab