[ACS-9583] Strip details segment from url (#5294)

* [ACS-9583] Fix the routing to viewer

* [ACS-9583] Splice all segments after details

* [ACS-9583] Fix unit test
This commit is contained in:
Shivangi Shree
2026-07-24 11:20:44 +05:30
committed by GitHub
parent fefdd50719
commit b962f28edc
2 changed files with 14 additions and 0 deletions
@@ -89,5 +89,14 @@ describe('ViewerEffects', () => {
expect(router.navigateByUrl['calls'].argsFor(0)[0].toString()).toEqual('/view/(viewer:nodeId)?path=absolute-path');
}));
it('should navigate to the parent route and preserve the original location when opening the viewer', fakeAsync(() => {
store.dispatch(new ViewNodeAction('nodeId', { location: 'personal-files/details/abc123/permissions' }));
tick(100);
expect(router.navigateByUrl['calls'].argsFor(0)[0].toString()).toEqual(
'/personal-files/(viewer:view/nodeId)?location=personal-files%2Fdetails%2Fabc123%2Fpermissions'
);
}));
});
});
@@ -215,6 +215,11 @@ export class ViewerEffects {
const urlSegments: UrlSegment[] = urlSegmentGroup.segments;
const detailsIndex = urlSegments.findIndex((segment) => segment.path === 'details');
if (detailsIndex > -1) {
urlSegments.splice(detailsIndex);
}
return urlSegments.reduce(function (acc, item) {
acc.push(item.path, item.parameters);
return acc;