Skip to content

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

Merged
tdonohue merged 7 commits into
DSpace:mainfrom
DanGastardelli:BlankPagesWithout404
Nov 13, 2026
Merged

tdonohue merged 7 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.

@FrancescoMolinaro FrancescoMolinaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DanGastardelli , many thanks for addressing my feedback, I left just a comment for src/app/browse-by/browse-by-page-routes.ts, otherwise the PR looks good to me.

@github-project-automation github-project-automation Bot moved this from 🙋 Needs Reviewers Assigned to 👀 Under Review in DSpace 11.0 Release Oct 9, 2026
@github-project-automation github-project-automation Bot moved this from 👀 Under Review to 👍 Reviewer Approved in DSpace 11.0 Release Nov 12, 2026
@FrancescoMolinaro

Copy link
Copy Markdown
Contributor

Hi @DanGastardelli, many thanks for your work on this and sorry for the delay, it looks good to me!

@tdonohue tdonohue added the component: SEO Search Engine Optimization label Nov 13, 2026
@tdonohue tdonohue added this to the 11.0 milestone Nov 13, 2026

@tdonohue tdonohue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @DanGastardelli ! I gave this a test today as well and it works well. The code looks good too.

I'll attempt to auto-backport this to all maintenance releases.

@tdonohue
tdonohue merged commit 24a274d into DSpace:main Nov 13, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace 11.0 Release Nov 13, 2026
@dspace-bot

Copy link
Copy Markdown
Contributor

Backport failed for dspace-8_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-8_x
git worktree add -d .worktree/backport-6269-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-6269-to-dspace-8_x
git switch --create backport-6269-to-dspace-8_x
git cherry-pick -x 24a274d2758c7f2fb8a1e174231d109e32c10744

@dspace-bot

Copy link
Copy Markdown
Contributor

Backport failed for dspace-9_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-9_x
git worktree add -d .worktree/backport-6269-to-dspace-9_x origin/dspace-9_x
cd .worktree/backport-6269-to-dspace-9_x
git switch --create backport-6269-to-dspace-9_x
git cherry-pick -x 24a274d2758c7f2fb8a1e174231d109e32c10744

@dspace-bot

Copy link
Copy Markdown
Contributor

Successfully created backport PR for dspace-10_x:

tdonohue pushed a commit to tdonohue/dspace-angular that referenced this pull request Nov 13, 2026
DSpace#6269)

* Includes a redirect to the 404 page when accessing community, collection, and item pages without an ID.

* Fix for the last commit

* Extending handling to new components and code adjustments

* Aligning with best practices

* Aligning with best practices

* Update browse-by component

* Update browse-by component
tdonohue pushed a commit that referenced this pull request Nov 13, 2026
#6269) (#6538)

* Includes a redirect to the 404 page when accessing community, collection, and item pages without an ID.

* Fix for the last commit

* Extending handling to new components and code adjustments

* Aligning with best practices

* Aligning with best practices

* Update browse-by component

* Update browse-by component

(cherry picked from commit 24a274d)

Co-authored-by: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com>
tdonohue added a commit that referenced this pull request Nov 13, 2026
#6269) (#6539)

* Includes a redirect to the 404 page when accessing community, collection, and item pages without an ID.

* Fix for the last commit

* Extending handling to new components and code adjustments

* Aligning with best practices

* Aligning with best practices

* Update browse-by component

* Update browse-by component

Co-authored-by: Daniel Pais <55243638+DanGastardelli@users.noreply.github.com>
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 component: SEO Search Engine Optimization 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: ✅ Done

Development

Successfully merging this pull request may close these issues.

5 participants