Skip to content

Commit 8af3d14

Browse files
committed
[UXP-124] Fix redirect when a viewer is used
1 parent 9a8bb16 commit 8af3d14

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/app/item-page/cris-item-page-tab.resolver.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class CrisItemPageTabResolver implements Resolve<RemoteData<PaginatedList
5656
const urlSplit = state.url.split(route.params.id);
5757
const tabArguments = urlSplit[1]?.split('/');
5858
const givenTab = tabArguments[1];
59+
const hasViewer: boolean = isNotEmpty(tabArguments[2]) && tabArguments[2] === 'viewer';
5960
const itemPageRoute = getItemPageRoute(itemRD.payload);
6061
const isValidTab = tabsRD.payload.page.some((tab) => !givenTab || tab.shortname === givenTab);
6162

@@ -66,7 +67,7 @@ export class CrisItemPageTabResolver implements Resolve<RemoteData<PaginatedList
6667
if (!isValidTab) {
6768
// If wrong tab is given redirect to 404 page
6869
this.router.navigateByUrl(getPageNotFoundRoute(), { skipLocationChange: true, replaceUrl: false });
69-
} else if (givenTab === mainTab.shortname) {
70+
} else if (givenTab === mainTab.shortname && !hasViewer) {
7071
if (isPlatformServer(this.platformId)) {
7172
// If first tab is given redirect to root item page
7273
this.hardRedirectService.redirect(itemPageRoute, 302);

0 commit comments

Comments
 (0)