Skip to content

VSB-TUO/fix(static-page): return HTTP 404 for missing static pages - #1460

Merged
milanmajchrak merged 2 commits into
customer/vsb-tuofrom
vsb-tuo/fix-static-page-404
Aug 19, 2026
Merged

VSB-TUO/fix(static-page): return HTTP 404 for missing static pages#1460
milanmajchrak merged 2 commits into
customer/vsb-tuofrom
vsb-tuo/fix-static-page-404

Conversation

@Kasinhou

@Kasinhou Kasinhou commented Aug 18, 2026

Copy link
Copy Markdown

Problem

/static/<missing> answered HTTP 200 with an empty shell instead of a 404 page. StaticPageComponent tried to load static-files/error.html and, when that was empty/missing, rendered nothing and never set a 404 status. UNIVERSAL-016 (dspace-ui-tests notFoundPage.spec.tsnon-existent static page shows 404 page) failed on this instance, while dtq-dev returns a proper 404.

Fix

  • Set the SSR response to 404 via ServerResponseService.setNotFound() when the static file is not found.
  • Render the inline 404 page (same markup + reused 404.* i18n keys as PageNotFoundComponent) via a contentState (loading / found / not-found).
  • Drop the legacy error.html loading path.
  • Update the unit spec (provide ServerResponseService, add a not-found test).

Mirrors the verified dtq-dev fix (f8495ea85c) on the same Angular 15 base.

Result

/static/<missing> now returns HTTP 404 with the "404 / Take me to the home page" page — matching dtq-dev. Verified locally with an AOT ng build (development) on the sav branch (identical change across all four customers).
566-vsb-tuo-static-404

Refs dataquest-dev/dspace-customers#566

🤖 Generated with Claude Code

StaticPageComponent rendered an empty shell and answered HTTP 200 when a
`/static/<file>` page did not exist: it tried to load `static-files/error.html`
and, when that was empty/missing, showed nothing and never set a 404 status.
UNIVERSAL-016 (dspace-ui-tests notFoundPage.spec.ts) therefore failed on the
"non-existent static page shows 404 page" case.

Set the SSR response to 404 via ServerResponseService and render the inline
404 page (same markup + reused `404.*` i18n keys as PageNotFoundComponent) when
the content is not found. Drop the legacy error.html loading path.

Behaviour now matches dtq-dev: /static/<missing> returns 404 with the "404 /
Take me to the home page" page.

Refs dataquest-dev/dspace-customers#566

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes incorrect HTTP 200 responses for missing /static/<page> routes by explicitly switching to a 404 SSR response and rendering an inline 404 view when the requested static HTML file can’t be loaded.

Changes:

  • Add a contentState (loading / found / not-found) to drive UI rendering for static pages, including an inline 404 view.
  • Set SSR response status to 404 via ServerResponseService.setNotFound() when static content is missing.
  • Update the unit test to provide ServerResponseService and assert the not-found behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/app/static-page/static-page.component.ts Adds SSR 404 signaling and state-driven rendering for missing static content.
src/app/static-page/static-page.component.html Introduces loading / content / inline-404 template branches.
src/app/static-page/static-page.component.spec.ts Extends tests to cover the new not-found behavior and SSR status call.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/app/static-page/static-page.component.ts
Comment thread src/app/static-page/static-page.component.html Outdated
…yped spy

- Add role="link" tabindex="0" to the inline 404 home link so it matches
  PageNotFoundComponent (same as dtq-dev), per Copilot review.
- Type the HtmlContentService test spy as jasmine.SpyObj<HtmlContentService>
  instead of `any`.

Refs dataquest-dev/dspace-customers#566

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Kasinhou
Kasinhou requested a review from milanmajchrak August 19, 2026 12:38
@milanmajchrak
milanmajchrak merged commit a547f9c into customer/vsb-tuo Aug 19, 2026
4 of 5 checks passed
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.

3 participants