mountPoint is only set for 'mountpoint' (unmanaged)

When restoring, mountPoint field is expected for managed mount points
This commit is contained in:
Girish Ramakrishnan
2022-01-26 12:59:34 -08:00
parent 8b9d821905
commit a786fad3ee
6 changed files with 17 additions and 11 deletions

View File

@@ -51,12 +51,13 @@ function getBackupPath(apiConfig) {
switch (apiConfig.provider) {
case PROVIDER_SSHFS:
case PROVIDER_MOUNTPOINT:
case PROVIDER_NFS:
case PROVIDER_CIFS:
case PROVIDER_EXT4:
return path.join(paths.MANAGED_BACKUP_MOUNT_DIR, apiConfig.prefix);
case PROVIDER_MOUNTPOINT:
return path.join(apiConfig.mountPoint, apiConfig.prefix);
default:
case PROVIDER_FILESYSTEM:
return apiConfig.backupFolder;
}
}
@@ -299,9 +300,11 @@ function testConfig(apiConfig, callback) {
let error = validateBackupTarget(apiConfig.backupFolder);
if (error) return callback(error);
} else { // cifs/ext4/nfs/mountpoint/sshfs
if (!apiConfig.mountPoint || typeof apiConfig.mountPoint !== 'string') return callback(new BoxError(BoxError.BAD_FIELD, 'mountPoint must be non-empty string', { field: 'mountPoint' }));
let error = validateBackupTarget(apiConfig.mountPoint);
if (error) return callback(error);
if (apiConfig.provider === PROVIDER_MOUNTPOINT) {
if (!apiConfig.mountPoint || typeof apiConfig.mountPoint !== 'string') return callback(new BoxError(BoxError.BAD_FIELD, 'mountPoint must be non-empty string', { field: 'mountPoint' }));
let error = validateBackupTarget(apiConfig.mountPoint);
if (error) return callback(error);
}
if (typeof apiConfig.prefix !== 'string') return callback(new BoxError(BoxError.BAD_FIELD, 'prefix must be a string', { field: 'prefix' }));
if (apiConfig.prefix !== '') {