ShellMountOperation doesn't like empty passwords
I have a smb volume without password. When I try to mount it via places-menu extension (which uses ShellMountOperation):
- It fails ("mkdir failed on directory /var/cache/samba: Permission denied").
- The dialog is not closed and therefore the ui is locked.
A small fix for my usage:
_onAskPassword(op, message, defaultUser, defaultDomain, flags) {
if (this._existingDialog) {
this._dialog = this._existingDialog;
this._dialog.reaskPassword();
} else {
this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags);
}
this._dialogId = this._dialog.connect('response',
(object, choice, password, remember) => {
if (choice == -1) {
this.mountOp.reply(Gio.MountOperationResult.ABORTED);
} else {
if (remember)
this.mountOp.set_password_save(Gio.PasswordSave.PERMANENTLY);
else
this.mountOp.set_password_save(Gio.PasswordSave.NEVER);
- this.mountOp.set_password(password);
+ this.mountOp.set_password(password ? password : 'anything');
this.mountOp.reply(Gio.MountOperationResult.HANDLED);
}
});
this._dialog.open();
},