Skip to content

Commit

Permalink
NavWindow: fix folder permissions bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedr2001 committed Apr 12, 2023
1 parent 0026352 commit 2646572
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions navigator/components/NavWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ export class NavWindow {
}

async mkdir() {
let current_user;
var user_promise = cockpit.user();
user_promise.then(user => current_user = user.name);
let response = await this.modal_prompt.prompt("Creating Directory",
{
new_name: {
Expand All @@ -519,14 +522,23 @@ export class NavWindow {
}
var promise = new Promise((resolve, reject) => {
var proc = cockpit.spawn(
["mkdir", this.pwd().path_str() + "/" + new_dir_name],
{superuser: "try", err: "out"}
["runuser", "-u", current_user, "mkdir", this.pwd().path_str() + "/" + new_dir_name],
{superuser: "require", err: "out"}
);
proc.done((data) => {
resolve();
});
proc.fail((e, data) => {
reject(data);
var proc2 = cockpit.spawn(
["mkdir", this.pwd().path_str() + "/" + new_dir_name],
{superuser: "try", err: "out"}
);
proc2.done((data) => {
resolve();
});
proc2.fail((e, data) => {
reject(data);
})
});
});
try {
Expand Down

0 comments on commit 2646572

Please sign in to comment.