Fix restore search error in RestoreController (#4998)
* Fix restore search error in RestoreController. TypeError: Cannot read Property 'Path' of undefined. Add a break to for loop, thanks @tx0h (#4997). * Remove empty '\' entries from restore picker. The paths are split by dirsep, but directories end with it, which results in an empty part at the end.
This commit is contained in:
@@ -246,6 +246,10 @@ backupApp.controller('RestoreController', function ($rootScope, $scope, $routePa
|
||||
if (cp.indexOf(compareablePath(sn.Path)) == 0) {
|
||||
var curpath = sn.Path;
|
||||
var parts = p.substr(sn.Path.length).split(dirsep);
|
||||
// Remove empty part if path had dirsep at end
|
||||
if (parts[parts.length - 1].length == 0) {
|
||||
parts.pop();
|
||||
}
|
||||
var col = sn;
|
||||
|
||||
for(var k in parts) {
|
||||
@@ -261,6 +265,7 @@ backupApp.controller('RestoreController', function ($rootScope, $scope, $routePa
|
||||
if (compareablePath(col.Children[m].Path) == compareablePath(curpath)) {
|
||||
found = true;
|
||||
col = col.Children[m];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user