Skip to content

Includes a redirect to the 404 page when accessing community, collect… - #6269

Open
DanGastardelli wants to merge 5 commits into
DSpace:mainfrom
DanGastardelli:BlankPagesWithout404
Open

DanGastardelli wants to merge 5 commits into
DSpace:mainfrom
DanGastardelli:BlankPagesWithout404

Conversation

@DanGastardelli

Copy link
Copy Markdown
Contributor

References

#6260

Description

When accessing a community, collection, or item page without an ID, a blank page appears with no message or error.

The user should see a 404 error page instead.

Instructions for Reviewers

Access pages such as:

http://localhost:4000/communities

http://localhost:4000/collections

http://localhost:4000/items

The 404 error page should be displayed.

In the "community-page", "collection-page", and "item-page" components, I added the following handling in the routing configuration:

{
path: '',
component: ThemedPageNotFoundComponent,
canActivate: [endUserAgreementCurrentUserGuard],
}

@lgeggleston lgeggleston added bug error handling How errors are handled from REST API 1 APPROVAL pull request only requires a single approval to merge port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release port to dspace-10_x This PR needs to be ported to `dspace-10_x` branch for next bug-fix release labels Sep 25, 2026
@lgeggleston lgeggleston moved this to 🙋 Needs Reviewers Assigned in DSpace 11.0 Release Sep 25, 2026
@FrancescoMolinaro

Copy link
Copy Markdown
Contributor

Hi @DanGastardelli , many thanks for your work on this, much appreciated.

Overall the approach looks good to me, I would just consider to applying the same fix also on other routes, for instance:

/edit-items or /bitstreams

In general all the routes that ends with a param like :id/:something can produce this issue.
I would also remove the guard endUserAgreementCurrentUserGuard as in general we don't guard the 404, check app-routes.ts for reference.

For consistency with the app-level 404 page and to avoid issue with the missing title I would suggest to use the same configuration we have in the main routing file, something like:

{ path: '', component: ThemedPageNotFoundComponent, pathMatch: 'full', data: { title: '404.page-not-found' } }

@DanGastardelli

Copy link
Copy Markdown
Contributor Author

Hi @FrancescoMolinaro

I’ve made the requested adjustments, expanding on the proposed approach.

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

Labels

1 APPROVAL pull request only requires a single approval to merge bug error handling How errors are handled from REST API port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release port to dspace-9_x This PR needs to be ported to `dspace-9_x` branch for next bug-fix release port to dspace-10_x This PR needs to be ported to `dspace-10_x` branch for next bug-fix release

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

3 participants