fix returning to previous dir on inaccessible

This commit is contained in:
joshuaboud 2021-05-26 13:35:51 -03:00
parent ea07f04a34
commit 049cd5f489
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E

View File

@ -208,7 +208,11 @@ class NavDir extends NavEntry {
} }
async get_children(nav_window_ref) { async get_children(nav_window_ref) {
var children = []; var children = [];
var data = await cockpit.spawn(["/usr/share/cockpit/navigator/scripts/ls.py", this.path_str()], {err:"ignore"}); var proc = cockpit.spawn(["/usr/share/cockpit/navigator/scripts/ls.py", this.path_str()], {err:"out", superuser: "try"});
proc.fail((e, data) => {
window.alert(data);
})
var data = await proc;
var response = JSON.parse(data); var response = JSON.parse(data);
this.stat = response["."]["stat"]; this.stat = response["."]["stat"];
var entries = response["children"]; var entries = response["children"];
@ -292,9 +296,7 @@ class NavWindow {
this.path_stack.push(new_dir); this.path_stack.push(new_dir);
this.path_stack_index = this.path_stack.length - 1; this.path_stack_index = this.path_stack.length - 1;
this.refresh().catch(() => { this.refresh().catch(() => {
this.path_stack.pop(); this.back();
this.refresh();
window.alert(new_dir.path_str() + " is inaccessible.");
}); });
} }
back() { back() {