Skip to content

[DURACOM-496] fix redirect for item page resolver#5857

Open
FrankGameDev wants to merge 2 commits into
DSpace:mainfrom
4Science:task/main/DURACOM-496
Open

[DURACOM-496] fix redirect for item page resolver#5857
FrankGameDev wants to merge 2 commits into
DSpace:mainfrom
4Science:task/main/DURACOM-496

Conversation

@FrankGameDev

Copy link
Copy Markdown

Porting of [CST-24936]

References

Description

Fixes the issue #5853

List of changes in this PR:

  1. Fixed redirect URL capture in authorized.operators.ts: Changed the redirectOn4xx operator to use router.getCurrentNavigation()?.extractedUrl?.toString() instead of router.url when capturing the redirect URL for unauthenticated users hitting 401/403 errors. This ensures the actual destination URL is captured during resolvers, rather than the stale previous URL.
  2. Added getCurrentNavigation to router spy in tests: Updated the test spy in operators.spec.ts to include the getCurrentNavigation method so existing tests continue to pass.

How to test it

  1. Log in as administrator
  2. Navigate to a restricted item
  3. Copy the item URL and open it in a new browser tab
  4. Expected (after fix): User is redirected to login page, and after login, redirected back to the restricted item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant