frontmatter: an unterminated quoted scalar is accepted silently and keeps its opening quote

Closed Beginner friendly
#138 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
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, node.js
Domain
content, testing

Research direction

Read site/lib/frontmatter.mjs and lib.test.mjs first; inspect how parseScalar handles quoted values and how frontmatter errors are reported with line numbers. Add rejecting cases for unterminated quoted scalars and list items, then run npm run validate and confirm the fixture reports the line of the unclosed quote.

Written by the indexing model from the issue text.

Description

bug priority: low

Why it matters

name: "Foo (a missing closing quote, an easy slip when a name contains an apostrophe) parses as the string "Foo and flows into pages, data.json, the CSV and the feed with a stray quote. checkTitleMatchesName happens to catch it for name, but publisher, attribution_string, grid_dimensions, ue_versions and list items have no backstop.

Evidence (at 69387df)

site/lib/frontmatter.mjs:69-82 parseScalar only unquotes when the value both starts and ends with the same quote; otherwise it returns the raw text. Verified: parsing a frontmatter block containing name: "Foo yields meta.name === '"Foo' with errors empty.

Suggested approach

In parseScalar (or in parseFrontmatter where line numbers are known), when a trimmed value starts with " or ' and does not end with the matching quote, push line N: "key" opens a quote that is never closed. Same for list items.

Done when

lib.test.mjs has a rejecting case; npm run validate fails on a fixture with an unterminated quote and names the line.

Dominant language
JavaScript
Stars
58
Forks
15
Avg merge
1d 7h
Merged PRs (30d)
12

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 TMHSDigital/Free-Game-Dev-Assets

All issues in TMHSDigital/Free-Game-Dev-Assets

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.