diff --git a/js/controllers/website-controller.js b/js/controllers/website-controller.js index 29c64b2..782d72d 100644 --- a/js/controllers/website-controller.js +++ b/js/controllers/website-controller.js @@ -231,6 +231,7 @@ app.controller('websiteCtrl', [ } opts.progress.uploadTotal = 0; vm.buildNotification(result, msg); + vm.Sites.contents(vm.copyR, vm.previousSearchQuery); }); }; @@ -354,7 +355,7 @@ app.controller('websiteCtrl', [ vm.Sites.allContents = function (r) { vm.copyR = r; vm.strictPath = r.shareAccess.path; - + vm.previousSearchQuery = vm.strictPath; var pkg = Auth.oauth3.pkg('www@daplie.com'); return pkg.contents({ hostname: r.domain, @@ -400,6 +401,7 @@ app.controller('websiteCtrl', [ vm.siteDirectories = []; cleanPathQuery(dir); dir = vm.cleanedPath; + vm.previousSearchQuery = dir; vm.displaySpinner = ''; var pkg = Auth.oauth3.pkg('www@daplie.com'); console.log('searching ->', cleanPathQuery(vm.breadcrumbsPath.join('/'))); @@ -435,6 +437,7 @@ app.controller('websiteCtrl', [ }; vm.getDirectoriesFromBreadcrumbs = function (dir) { + debugger; if (vm.copyR.shareAccess.path !== '/') { var strictArray = vm.copyR.shareAccess.path.split('/'); console.log('searching ->', cleanPathQuery(vm.breadcrumbsPath.join('/'))); @@ -457,9 +460,10 @@ app.controller('websiteCtrl', [ if (vm.breadcrumbsPath.length === 0) { var breadcrumblies = vm.strictPath + dir; vm.breadcrumbsPath = breadcrumblies.split('/'); - } else { - vm.breadcrumbsPath.push(dir); } + // else { + // vm.breadcrumbsPath.push(dir); + // } vm.Sites.contents(vm.copyR, vm.breadcrumbsPath.join('/')); } else { vm.breadcrumbs.push(dir); @@ -483,9 +487,13 @@ app.controller('websiteCtrl', [ var requestedPath; if (r.shareAccess.path !== '/') { if (vm.breadcrumbsPath.length === 0) { - requestedPath = r.shareAccess.path + file; + requestedPath = r.shareAccess.path + '/' + file; } else { - requestedPath = vm.breadcrumbsPath.join('/') + '/' + file; + if (r.shareAccess.path !== '/' && vm.breadcrumbsPath.join('/') !== '') { + requestedPath = vm.breadcrumbsPath.join('/') + '/' + file; + } else { + requestedPath = vm.breadcrumbsPath.join('/') + '/' + file; + } } } else { if (vm.breadcrumbsPath.length === 0 && r.shareAccess.path === '/') { @@ -495,6 +503,7 @@ app.controller('websiteCtrl', [ } } requestedPath = cleanPathQuery(requestedPath); + debugger; opts = { path: requestedPath }; @@ -526,6 +535,7 @@ app.controller('websiteCtrl', [ }).then(function (result) { var msg = "'"+ vm.pathRemoved + "'" + ' has been removed'; vm.buildNotification(result, msg); + vm.Sites.contents(vm.copyR, vm.previousSearchQuery); }); };