From 33308688aac2bedba1a8f1ad020e7395ca3a43c2 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Mon, 11 Mar 2013 17:40:42 +0000 Subject: [PATCH] Ignore deleting nothing & strip trailing slashes Don't ask the user for any confirmation if there is nothing to delete. This could occur when you select something, delete it, then try to delete again. We need to also strip trailing slashes for deleting files when updating the file manager. This is much like what we needed to do with adding files to the root of the file manager. Locations should end without a trailing slash, but a root is a trailing slash as its only char. A regex here solves the issue. --- lib/ice-coder.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ice-coder.js b/lib/ice-coder.js index b9ba2b9..2fa7d2f 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -593,7 +593,9 @@ var ICEcoder = { deleteFile: function() { var delFiles, selectedFilesList; - delFiles = top.ICEcoder.ask('Delete:\n\n'+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n")+'?'); + if (top.ICEcoder.selectedFiles.length>0) { + delFiles = top.ICEcoder.ask('Delete:\n\n'+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n")+'?'); + } if (delFiles) { selectedFilesList = ""; for (var i=0;i