Skip to content

Sub-search 'about' text not HTML-decoded #33

@PortableProgrammer

Description

@PortableProgrammer

Problem

The subreddit search page renders data.public_description as raw text, while the standard subreddit listing page applies he.decode() to the same field. Result: HTML entities (&, ", ', etc.) leak through to users browsing search results.

Where

src/views/sub-search.pug:37 renders #{i.data.public_description} directly. Compare src/routes/index.js:677 which does about.public_description = he.decode(about.public_description) before rendering.

Fix

Decode the description in the /sub-search route handler before passing to the template (mirror the renderIndex pattern), or decode in the template via the htmlDecode helper already in postUtils.pug.

Reproduction

Search any subreddit with an apostrophe, ampersand, or special character in its description — /r/mapmaking, /r/appleswap were noted as examples. Compare the description shown on the search results page vs. the subreddit's own page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions