Fix crash

This commit is contained in:
Girish Ramakrishnan
2021-07-30 11:33:09 -07:00
parent 41c11d50c0
commit e4ce1a9ad3

View File

@@ -610,7 +610,7 @@ function userSearchSftp(req, res, next) {
const uidNumber = app.manifest.addons.localstorage.ftp.uid;
const [userGetError, user] = await users.getByUsername(username);
const [userGetError, user] = await safe(users.getByUsername(username));
if (userGetError) return next(new ldap.OperationsError(userGetError.toString()));
if (!user) return next(new ldap.OperationsError('Invalid username'));
@@ -620,7 +620,7 @@ function userSearchSftp(req, res, next) {
if (error) return next(new ldap.OperationsError(error.toString()));
if (!hasAccess) return next(new ldap.InsufficientAccessRightsError('Not authorized'));
var obj = {
const obj = {
dn: ldap.parseDN(`cn=${username}@${appFqdn},ou=sftp,dc=cloudron`).toString(),
attributes: {
homeDirectory: app.dataDir ? `/mnt/${app.id}` : `/mnt/appsdata/${app.id}/data`,