Ampersands in article metadata are not entity-escaped in OAI-PMH feed

Open Beginner friendly
#5,671 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
django, python
Domain
api

Research direction

Start with the OAI-PMH record template at src/templates/common/apis/OAI_record.xml, around line 38, where the page range value is rendered. Check whether autoescaping is turned off there or the value is marked safe, then apply an escape filter such as escape to the string fields. Done when an article with an ampersand in its page range produces an OAI record that parses as valid XML.

Written by the indexing model from the issue text.

Description

bug

Problem

CLOCKSS reported that they could not load an OAI-PMH feed on UGent because of a bare ampersand in the value of a page range field.

Ticket: https://janeway.freshdesk.com/a/tickets/13012

Template where string needs needing entity-escaping: https://github.com/openlibhums/janeway/blob/4699e72244f384217e1551ea2e5da97dc02116a1/src/templates/common/apis/OAI_record.xml#L38

Solution

Use a template filter in all string values in the OAI-PMH template to escape ampersands.

Dominant language
Python
Stars
241
Forks
97
Avg merge
3d 40m
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openlibhums/janeway

All issues in openlibhums/janeway

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.