Skip to content

[Port to dtq-dev-93] HTML-escape metadata and load the process log without a URL token - #1750

Open
milanmajchrak wants to merge 1 commit into
dtq-dev-93from
93/fe-port-escape-metadata
Open

milanmajchrak wants to merge 1 commit into
dtq-dev-93from
93/fe-port-escape-metadata

Conversation

@milanmajchrak

@milanmajchrak milanmajchrak commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

References

Ports these dtq-dev PRs:

Description

Metadata values are HTML-escaped before they are inserted with innerHTML in the places v9 does not cover yet, and the process output log is loaded without a token in the URL.

Instructions for Reviewers

v9 already escapes metadata values in result lists, grids and names, and the backend escapes hit highlights (discovery.highlights.escape-html). So the hit highlight part of 1665 is left out. The {{ }} display-only fields (journal editor and publisher, org unit address, item grid date) are left as in DSpace 9.3. This PR adds the parts that insert HTML, and the change from 1734.

List of changes in this PR:

  • EmphasizePipe (facet value suggestions) escapes the value and adds only the <em> tags.
  • makeLinks (item page description, full item page) escapes the text and builds the links from escaped parts. Links get rel="noopener noreferrer". The full item page now applies dsReplace before makeLinks, so it does not touch the escaped text.
  • The autocomplete and sponsor suggestions escape the vocabulary values they put around <b> and <br>.
  • The request-a-copy page escapes the item name it passes to the translated intro.
  • Name variant suggestions for person and org unit relations are shown as text, and the alternative names are read unescaped, so they are not escaped twice or stored escaped.
  • The process page loads the output log from the bitstream content link. HttpClient sends the Authorization header, so the short-lived token is no longer added to the URL.

Visible change: a description or full item page value that contains markup such as <i> now shows the tags as text.

How to test:

  • Give an item a title, author and description that contain & and <. Search for a word in the title. Results, the item page, the full item page and the facet suggestions show the value exactly as typed, and the matched word is still highlighted.
  • As admin, run a process and open its page. Click "Show output". The log loads, and the request in the browser dev tools has no authentication-token parameter.
  • npm run test -- --include=src/app/shared/utils/emphasize.pipe.spec.ts --include=src/app/shared/clarin-shared-util.spec.ts --include=src/app/item-page/simple/field-components/clarin-description-item-field/clarin-description-item-field.component.spec.ts --include=src/app/request-copy/grant-deny-request-copy/grant-deny-request-copy.component.spec.ts --include=src/app/shared/form/builder/ds-dynamic-form-ui/models/autocomplete/ds-dynamic-autocomplete.component.spec.ts --include=src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.spec.ts --include=src/app/process-page/detail/process-detail.component.spec.ts

Codex review (gpt-6.2-sol, high): 1 finding, the same as on dtq-dev. It needs hit highlights on dc.title.alternative, which the shipped discovery.xml does not have. Not changed.

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

…t a URL token

9968e2d escape submitter metadata before rendering it as HTML
254a002 load the process output log without a token in the URL

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