Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 33308688aac2bedba1a8f1ad020e7395ca3a43c2 1 parent df481aa
@mattpass authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/ice-coder.js
View
6 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<top.ICEcoder.selectedFiles.length;i++) {
@@ -761,7 +763,7 @@ var ICEcoder = {
// Deleting files
if (action=="delete") {
// Simply get our target and make it dissapear
- targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")+"|"+file).parentNode.parentNode;
+ targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\/$/, "").replace(/\//g,"|")+"|"+file).parentNode.parentNode;
targetElem.parentNode.removeChild(targetElem);
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.