{"action":"created","comment":{"url":"https://api.github.com/repos/silexlabs/unifile/pulls/comments/53163881","id":53163881,"diff_hunk":"@@ -343,13 +343,48 @@ exports.rm = function (path, request, response, next, cbk) {\n       exports.errNotLoggedIn(cbk);\n     }\n     else {\n-      ftpClientsArray[request.session.ftpClientId].delete(path, function (err) {\n-        if (err){\n-          console.error(err);\n-          cbk({success:false, message: err});\n-        }\n-        else\n-          cbk({success:true});\n+      path = path.replace(/\\/+$/,''); // remove last slash on directories\n+      var parentDir = path.replace(/^(.*)\\/[^\\/]+$/,'$1');\n+      ftpClientsArray[request.session.ftpClientId].list(parentDir, function(err, filesArray) {\n+          if(err)\n+          {\n+            cbk({success:false, message: err});\n+          }\n+          else\n+          {\n+            var filename = path.replace(/^.*\\//,'');\n+\n+            var item = filesArray.filter(function(x){ return x.name ===filename; });\n+            // path not found\n+            if(item.length===0)","path":"lib/services/ftp.js","position":24,"original_position":24,"commit_id":"b69df3983708107e26cba0a1033c7cede869a38e","original_commit_id":"b69df3983708107e26cba0a1033c7cede869a38e","user":{"login":"JbIPS","id":2248473,"avatar_url":"https://avatars.githubusercontent.com/u/2248473?v=3","gravatar_id":"","url":"https://api.github.com/users/JbIPS","html_url":"https://github.com/JbIPS","followers_url":"https://api.github.com/users/JbIPS/followers","following_url":"https://api.github.com/users/JbIPS/following{/other_user}","gists_url":"https://api.github.com/users/JbIPS/gists{/gist_id}","starred_url":"https://api.github.com/users/JbIPS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JbIPS/subscriptions","organizations_url":"https://api.github.com/users/JbIPS/orgs","repos_url":"https://api.github.com/users/JbIPS/repos","events_url":"https://api.github.com/users/JbIPS/events{/privacy}","received_events_url":"https://api.github.com/users/JbIPS/received_events","type":"User","site_admin":false},"body":"It would be very weird to enter this case, since your listing the containing directory","created_at":"2016-02-17T13:39:03Z","updated_at":"2016-02-17T13:39:03Z","html_url":"https://github.com/silexlabs/unifile/pull/50#discussion_r53163881","pull_request_url":"https://api.github.com/repos/silexlabs/unifile/pulls/50","_links":{"self":{"href":"https://api.github.com/repos/silexlabs/unifile/pulls/comments/53163881"},"html":{"href":"https://github.com/silexlabs/unifile/pull/50#discussion_r53163881"},"pull_request":{"href":"https://api.github.com/repos/silexlabs/unifile/pulls/50"}}},"pull_request":{"url":"https://api.github.com/repos/silexlabs/unifile/pulls/50","id":59641283,"html_url":"https://github.com/silexlabs/unifile/pull/50","diff_url":"https://github.com/silexlabs/unifile/pull/50.diff","patch_url":"https://github.com/silexlabs/unifile/pull/50.patch","issue_url":"https://api.github.com/repos/silexlabs/unifile/issues/50","number":50,"state":"open","locked":false,"title":"FTP: recursive delete for directories","user":{"login":"Sergio-Muriel","id":3207785,"avatar_url":"https://avatars.githubusercontent.com/u/3207785?v=3","gravatar_id":"","url":"https://api.github.com/users/Sergio-Muriel","html_url":"https://github.com/Sergio-Muriel","followers_url":"https://api.github.com/users/Sergio-Muriel/followers","following_url":"https://api.github.com/users/Sergio-Muriel/following{/other_user}","gists_url":"https://api.github.com/users/Sergio-Muriel/gists{/gist_id}","starred_url":"https://api.github.com/users/Sergio-Muriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sergio-Muriel/subscriptions","organizations_url":"https://api.github.com/users/Sergio-Muriel/orgs","repos_url":"https://api.github.com/users/Sergio-Muriel/repos","events_url":"https://api.github.com/users/Sergio-Muriel/events{/privacy}","received_events_url":"https://api.github.com/users/Sergio-Muriel/received_events","type":"User","site_admin":false},"body":"Fix for #49 ","created_at":"2016-02-17T13:10:50Z","updated_at":"2016-02-17T13:39:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c38392c66ae192dc9ce42b81ac3a844cc90b0f9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/silexlabs/unifile/pulls/50/commits","review_comments_url":"https://api.github.com/repos/silexlabs/unifile/pulls/50/comments","review_comment_url":"https://api.github.com/repos/silexlabs/unifile/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silexlabs/unifile/issues/50/comments","statuses_url":"https://api.github.com/repos/silexlabs/unifile/statuses/b69df3983708107e26cba0a1033c7cede869a38e","head":{"label":"Sergio-Muriel:ftp","ref":"ftp","sha":"b69df3983708107e26cba0a1033c7cede869a38e","user":{"login":"Sergio-Muriel","id":3207785,"avatar_url":"https://avatars.githubusercontent.com/u/3207785?v=3","gravatar_id":"","url":"https://api.github.com/users/Sergio-Muriel","html_url":"https://github.com/Sergio-Muriel","followers_url":"https://api.github.com/users/Sergio-Muriel/followers","following_url":"https://api.github.com/users/Sergio-Muriel/following{/other_user}","gists_url":"https://api.github.com/users/Sergio-Muriel/gists{/gist_id}","starred_url":"https://api.github.com/users/Sergio-Muriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sergio-Muriel/subscriptions","organizations_url":"https://api.github.com/users/Sergio-Muriel/orgs","repos_url":"https://api.github.com/users/Sergio-Muriel/repos","events_url":"https://api.github.com/users/Sergio-Muriel/events{/privacy}","received_events_url":"https://api.github.com/users/Sergio-Muriel/received_events","type":"User","site_admin":false},"repo":{"id":51689442,"name":"unifile","full_name":"Sergio-Muriel/unifile","owner":{"login":"Sergio-Muriel","id":3207785,"avatar_url":"https://avatars.githubusercontent.com/u/3207785?v=3","gravatar_id":"","url":"https://api.github.com/users/Sergio-Muriel","html_url":"https://github.com/Sergio-Muriel","followers_url":"https://api.github.com/users/Sergio-Muriel/followers","following_url":"https://api.github.com/users/Sergio-Muriel/following{/other_user}","gists_url":"https://api.github.com/users/Sergio-Muriel/gists{/gist_id}","starred_url":"https://api.github.com/users/Sergio-Muriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sergio-Muriel/subscriptions","organizations_url":"https://api.github.com/users/Sergio-Muriel/orgs","repos_url":"https://api.github.com/users/Sergio-Muriel/repos","events_url":"https://api.github.com/users/Sergio-Muriel/events{/privacy}","received_events_url":"https://api.github.com/users/Sergio-Muriel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sergio-Muriel/unifile","description":"Unified access to cloud storage services through a simple web API.","fork":true,"url":"https://api.github.com/repos/Sergio-Muriel/unifile","forks_url":"https://api.github.com/repos/Sergio-Muriel/unifile/forks","keys_url":"https://api.github.com/repos/Sergio-Muriel/unifile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sergio-Muriel/unifile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sergio-Muriel/unifile/teams","hooks_url":"https://api.github.com/repos/Sergio-Muriel/unifile/hooks","issue_events_url":"https://api.github.com/repos/Sergio-Muriel/unifile/issues/events{/number}","events_url":"https://api.github.com/repos/Sergio-Muriel/unifile/events","assignees_url":"https://api.github.com/repos/Sergio-Muriel/unifile/assignees{/user}","branches_url":"https://api.github.com/repos/Sergio-Muriel/unifile/branches{/branch}","tags_url":"https://api.github.com/repos/Sergio-Muriel/unifile/tags","blobs_url":"https://api.github.com/repos/Sergio-Muriel/unifile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sergio-Muriel/unifile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sergio-Muriel/unifile/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sergio-Muriel/unifile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sergio-Muriel/unifile/statuses/{sha}","languages_url":"https://api.github.com/repos/Sergio-Muriel/unifile/languages","stargazers_url":"https://api.github.com/repos/Sergio-Muriel/unifile/stargazers","contributors_url":"https://api.github.com/repos/Sergio-Muriel/unifile/contributors","subscribers_url":"https://api.github.com/repos/Sergio-Muriel/unifile/subscribers","subscription_url":"https://api.github.com/repos/Sergio-Muriel/unifile/subscription","commits_url":"https://api.github.com/repos/Sergio-Muriel/unifile/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sergio-Muriel/unifile/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sergio-Muriel/unifile/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sergio-Muriel/unifile/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sergio-Muriel/unifile/contents/{+path}","compare_url":"https://api.github.com/repos/Sergio-Muriel/unifile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sergio-Muriel/unifile/merges","archive_url":"https://api.github.com/repos/Sergio-Muriel/unifile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sergio-Muriel/unifile/downloads","issues_url":"https://api.github.com/repos/Sergio-Muriel/unifile/issues{/number}","pulls_url":"https://api.github.com/repos/Sergio-Muriel/unifile/pulls{/number}","milestones_url":"https://api.github.com/repos/Sergio-Muriel/unifile/milestones{/number}","notifications_url":"https://api.github.com/repos/Sergio-Muriel/unifile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sergio-Muriel/unifile/labels{/name}","releases_url":"https://api.github.com/repos/Sergio-Muriel/unifile/releases{/id}","deployments_url":"https://api.github.com/repos/Sergio-Muriel/unifile/deployments","created_at":"2016-02-14T10:02:58Z","updated_at":"2016-02-14T10:02:59Z","pushed_at":"2016-02-17T13:12:33Z","git_url":"git://github.com/Sergio-Muriel/unifile.git","ssh_url":"git@github.com:Sergio-Muriel/unifile.git","clone_url":"https://github.com/Sergio-Muriel/unifile.git","svn_url":"https://github.com/Sergio-Muriel/unifile","homepage":"","size":1001,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"silexlabs:master","ref":"master","sha":"95e45b2d7f1e790ef391feafbd855972dd69c6e2","user":{"login":"silexlabs","id":803706,"avatar_url":"https://avatars.githubusercontent.com/u/803706?v=3","gravatar_id":"","url":"https://api.github.com/users/silexlabs","html_url":"https://github.com/silexlabs","followers_url":"https://api.github.com/users/silexlabs/followers","following_url":"https://api.github.com/users/silexlabs/following{/other_user}","gists_url":"https://api.github.com/users/silexlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/silexlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silexlabs/subscriptions","organizations_url":"https://api.github.com/users/silexlabs/orgs","repos_url":"https://api.github.com/users/silexlabs/repos","events_url":"https://api.github.com/users/silexlabs/events{/privacy}","received_events_url":"https://api.github.com/users/silexlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":9845489,"name":"unifile","full_name":"silexlabs/unifile","owner":{"login":"silexlabs","id":803706,"avatar_url":"https://avatars.githubusercontent.com/u/803706?v=3","gravatar_id":"","url":"https://api.github.com/users/silexlabs","html_url":"https://github.com/silexlabs","followers_url":"https://api.github.com/users/silexlabs/followers","following_url":"https://api.github.com/users/silexlabs/following{/other_user}","gists_url":"https://api.github.com/users/silexlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/silexlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silexlabs/subscriptions","organizations_url":"https://api.github.com/users/silexlabs/orgs","repos_url":"https://api.github.com/users/silexlabs/repos","events_url":"https://api.github.com/users/silexlabs/events{/privacy}","received_events_url":"https://api.github.com/users/silexlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silexlabs/unifile","description":"Unified access to cloud storage services through a simple web API.","fork":false,"url":"https://api.github.com/repos/silexlabs/unifile","forks_url":"https://api.github.com/repos/silexlabs/unifile/forks","keys_url":"https://api.github.com/repos/silexlabs/unifile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silexlabs/unifile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silexlabs/unifile/teams","hooks_url":"https://api.github.com/repos/silexlabs/unifile/hooks","issue_events_url":"https://api.github.com/repos/silexlabs/unifile/issues/events{/number}","events_url":"https://api.github.com/repos/silexlabs/unifile/events","assignees_url":"https://api.github.com/repos/silexlabs/unifile/assignees{/user}","branches_url":"https://api.github.com/repos/silexlabs/unifile/branches{/branch}","tags_url":"https://api.github.com/repos/silexlabs/unifile/tags","blobs_url":"https://api.github.com/repos/silexlabs/unifile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silexlabs/unifile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silexlabs/unifile/git/refs{/sha}","trees_url":"https://api.github.com/repos/silexlabs/unifile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silexlabs/unifile/statuses/{sha}","languages_url":"https://api.github.com/repos/silexlabs/unifile/languages","stargazers_url":"https://api.github.com/repos/silexlabs/unifile/stargazers","contributors_url":"https://api.github.com/repos/silexlabs/unifile/contributors","subscribers_url":"https://api.github.com/repos/silexlabs/unifile/subscribers","subscription_url":"https://api.github.com/repos/silexlabs/unifile/subscription","commits_url":"https://api.github.com/repos/silexlabs/unifile/commits{/sha}","git_commits_url":"https://api.github.com/repos/silexlabs/unifile/git/commits{/sha}","comments_url":"https://api.github.com/repos/silexlabs/unifile/comments{/number}","issue_comment_url":"https://api.github.com/repos/silexlabs/unifile/issues/comments{/number}","contents_url":"https://api.github.com/repos/silexlabs/unifile/contents/{+path}","compare_url":"https://api.github.com/repos/silexlabs/unifile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silexlabs/unifile/merges","archive_url":"https://api.github.com/repos/silexlabs/unifile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silexlabs/unifile/downloads","issues_url":"https://api.github.com/repos/silexlabs/unifile/issues{/number}","pulls_url":"https://api.github.com/repos/silexlabs/unifile/pulls{/number}","milestones_url":"https://api.github.com/repos/silexlabs/unifile/milestones{/number}","notifications_url":"https://api.github.com/repos/silexlabs/unifile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silexlabs/unifile/labels{/name}","releases_url":"https://api.github.com/repos/silexlabs/unifile/releases{/id}","deployments_url":"https://api.github.com/repos/silexlabs/unifile/deployments","created_at":"2013-05-03T22:02:08Z","updated_at":"2016-02-15T17:32:22Z","pushed_at":"2016-02-17T13:12:34Z","git_url":"git://github.com/silexlabs/unifile.git","ssh_url":"git@github.com:silexlabs/unifile.git","clone_url":"https://github.com/silexlabs/unifile.git","svn_url":"https://github.com/silexlabs/unifile","homepage":"","size":975,"stargazers_count":20,"watchers_count":20,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":12,"forks":13,"open_issues":12,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/silexlabs/unifile/pulls/50"},"html":{"href":"https://github.com/silexlabs/unifile/pull/50"},"issue":{"href":"https://api.github.com/repos/silexlabs/unifile/issues/50"},"comments":{"href":"https://api.github.com/repos/silexlabs/unifile/issues/50/comments"},"review_comments":{"href":"https://api.github.com/repos/silexlabs/unifile/pulls/50/comments"},"review_comment":{"href":"https://api.github.com/repos/silexlabs/unifile/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silexlabs/unifile/pulls/50/commits"},"statuses":{"href":"https://api.github.com/repos/silexlabs/unifile/statuses/b69df3983708107e26cba0a1033c7cede869a38e"}}}}