Skip to content

[dtq-dev-93] Fix links, icon and feedback page URL under a non-root base href - #1759

Open
milanmajchrak wants to merge 4 commits into
dtq-dev-93from
93/fe-namespace-links
Open

milanmajchrak wants to merge 4 commits into
dtq-dev-93from
93/fe-namespace-links

Conversation

@milanmajchrak

@milanmajchrak milanmajchrak commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

References

Not a port. The same bugs are on DSpace/dspace-angular main (checked 2026-11-26), with no upstream issue or PR for them. The links use the fix the fork already has for the "latest version" notice (0e9772a).

Description

Under a non-root base href such as /repository/, the drag handle icon, five links and the feedback page URL miss the base href, so they get a 404 or a 400. Now they include it.

Instructions for Reviewers

The router adds the base href to routerLink, but the browser does not add it to a root-relative URL that skips the router. All fixes below are no-ops when the base href is /.

List of changes in this PR:

  • .drag-icon loads grip-vertical.svg with the ^ prefix, the same way $fa-font-path loads the Font Awesome fonts. The build now emits a relative URL, so the icon loads from /repository/assets/....
  • Three translations render a router path in a raw <a href>. The path now goes through Location.prepareExternalUrl:
    • the "assign roles" link in the workflow group alert of the group form,
    • the item link on the request-a-copy grant/deny page,
    • the "View" link in the notification after "Approve & import" on the suggestions page.
  • The content reports (Admin > Reports > Collections and Items) link the community, collection and item handles as handle/... instead of /handle/..., so they open under the base href.
  • The feedback form sends the page URL with the base href. The REST API rejects a page that is not under dspace.ui.url with 400 "unexpected page url was submitted". After a successful submit, the form goes back to the router URL it started from.

How to test (UI built with ui.nameSpace: /repository):

  • Open a submission with a repeatable field, or edit an item's metadata. The drag handle icon shows, and DevTools has no 404 for grip-vertical.svg. In the build output, *-theme.css has url('assets/images/grip-vertical.svg').
  • As admin, open a workflow group of a collection (Access Control > Groups). The "assign roles" link in the alert opens the collection's roles tab.
  • Open a request-a-copy grant link from the mail. The item link in the intro opens the item.
  • On a suggestions page, approve and import a suggestion. The "View" link in the notification opens the new workspace item.
  • As admin, open Admin > Reports > Collections and submit. The community and collection links open /repository/handle/.... The same for the item and collection links in Admin > Reports > Items.
  • With feedback.recipient and mail set up on the backend, open "Send Feedback" from any page and send it. The Page field has /repository in it, the request succeeds, and the form goes back to that page.
  • npm run test -- --include=src/app/access-control/group-registry/group-form/group-form.component.spec.ts --include=src/app/request-copy/grant-deny-request-copy/grant-deny-request-copy.component.spec.ts --include=src/app/suggestions-page/suggestions-page.component.spec.ts --include=src/app/info/feedback/feedback-form/feedback-form.component.spec.ts --include=src/app/admin/admin-reports

robots.txt is not part of this PR. The UI serves it at the domain root /robots.txt, so the web server must pass that path to the UI.

Codex review (gpt-6.2-sol, high): 1 finding fixed (the return after feedback dropped a final /index.html). The last round found nothing. Codex review: not run (usage limit) on the last commit, the report links.

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

🤖 Generated with Claude Code

milanmajchrak and others added 4 commits November 26, 2026 14:19
The mask url was root-relative, so the browser ignored the base href and got a 404.
The '^' prefix makes the build emit a relative url, like the Font Awesome font path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The group form roles link, the request-a-copy item link and the suggestion import
notification put a router path in a raw <a href>, which ignores the base href.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The REST API only accepts a page under dspace.ui.url, so a url without the base href got a 400.
After a successful submit the form goes back to the router url it started from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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