@@ -45,6 +45,10 @@ export class SyncPathsManager {
4545 if ( req . space . quotaIsExceeded ) {
4646 throw new HttpException ( 'Storage quota exceeded' , HttpStatus . INSUFFICIENT_STORAGE )
4747 }
48+
49+ // Check DB path
50+ const syncDBProps : SyncDBProps = await this . getDBProps ( req . space )
51+
4852 if ( ! ( await isPathExists ( req . space . realPath ) ) ) {
4953 throw new HttpException ( `Remote path not found : ${ syncPathDto . remotePath } ` , HttpStatus . NOT_FOUND )
5054 }
@@ -55,9 +59,8 @@ export class SyncPathsManager {
5559 if ( ! client ) {
5660 throw new HttpException ( 'Client not found' , HttpStatus . NOT_FOUND )
5761 }
58- const syncDBProps : SyncDBProps = await this . getDBProps ( req . space )
5962
60- // important : ensures the right remote path is used and stored
63+ // important: ensures the right remote path is used and stored
6164 syncPathDto . remotePath = req . params [ '*' ]
6265 // add permissions (skip end point protection using getEnvPermission)
6366 syncPathDto . permissions = getEnvPermissions ( req . space , req . space . root )
@@ -194,17 +197,17 @@ export class SyncPathsManager {
194197
195198 private async getDBProps ( space : SpaceEnv ) : Promise < SyncDBProps > {
196199 if ( space . inSharesList ) {
197- throw new HttpException ( 'Sync all shares is not supported, you must select a sub-directory ' , HttpStatus . BAD_REQUEST )
200+ throw new HttpException ( 'Syncing all shares is not supported. Please select a subdirectory ' , HttpStatus . BAD_REQUEST )
198201 } else if ( space . inPersonalSpace ) {
199202 if ( space . paths . length ) {
200203 return { ownerId : space . dbFile . ownerId , fileId : await this . getOrCreateFileId ( space ) }
201204 } else {
202- return { ownerId : space . dbFile . ownerId }
205+ throw new HttpException ( 'Syncing all personal files is not supported. Please select a subdirectory' , HttpStatus . BAD_REQUEST )
203206 }
204207 } else if ( space . inFilesRepository ) {
205208 if ( ! space ?. root ?. alias ) {
206209 // The synchronization direction should be adapted for each root depending on the permissions, this is not yet supported
207- throw new HttpException ( 'Sync all space is not yet supported, you must select a sub-directory ' , HttpStatus . BAD_REQUEST )
210+ throw new HttpException ( 'Syncing the entire space is not yet supported. Please select a subdirectory ' , HttpStatus . BAD_REQUEST )
208211 }
209212 if ( space . root . id && ! space . paths . length ) {
210213 return { spaceId : space . id , spaceRootId : space . root . id }
0 commit comments