diff --git a/projects/aca-shared/src/lib/services/content-api.service.ts b/projects/aca-shared/src/lib/services/content-api.service.ts index e080f8fbd..c1d68b3c5 100644 --- a/projects/aca-shared/src/lib/services/content-api.service.ts +++ b/projects/aca-shared/src/lib/services/content-api.service.ts @@ -84,7 +84,7 @@ export class ContentApiService { getNodeInfo(nodeId: string, options?: any): Observable { const defaults = { - include: ['isFavorite', 'allowableOperations'] + include: ['isFavorite', 'allowableOperations', 'path'] }; const queryOptions = Object.assign(defaults, options || {}); diff --git a/projects/adf-office-services-ext/src/lib/aos-extension.service.ts b/projects/adf-office-services-ext/src/lib/aos-extension.service.ts index dbc75f64d..883b0cbc4 100644 --- a/projects/adf-office-services-ext/src/lib/aos-extension.service.ts +++ b/projects/adf-office-services-ext/src/lib/aos-extension.service.ts @@ -92,9 +92,28 @@ export class AosEditOnlineService { private triggerEditOnlineAos(node: MinimalNodeEntryEntity): void { const aosHost = this.appConfigService.get('aosHost'); - const url = `${aosHost}/_aos_nodeid/${this.getNodeId( - node - )}/${encodeURIComponent(node.name)}`; + let url: string; + const pathElements = (node.path.elements || []).map( + segment => segment.name + ); + + if (!pathElements.length) { + url = `${aosHost}/Company Home/_aos_nodeid/${this.getNodeId( + node + )}/${encodeURIComponent(node.name)}`; + } + + if (pathElements.length === 1) { + url = `${aosHost}/${encodeURIComponent(node.name)}`; + } + + if (pathElements.length > 1) { + const root = pathElements[1]; + url = `${aosHost}/${root}/_aos_nodeid/${this.getNodeId( + node + )}/${encodeURIComponent(node.name)}`; + } + const fileExtension = getFileExtension(node.name); const protocolHandler = this.getProtocolForFileExtension(fileExtension);