Skip to content

Use replace callbacks in applyTemplate to preserve dollar sequences #2

@flamerged

Description

@flamerged

While vendoring Archify into education-partners-tech/website, CodeRabbit found that archify/renderers/shared/utils.mjs uses String.prototype.replace with generated replacement strings.\n\nBecause replace treats replacement-string tokens such as $&, , and 81067 specially, diagram titles, subtitles, SVG markup, cards, or footer text containing dollar sequences can be corrupted during template application.\n\nSuggested fix: use replacer callbacks for all generated replacement values in applyTemplate, e.g. .replace(TEMPLATE_PLACEHOLDERS[0], () => value), and likewise for SVG_SLOT_RE, CARDS_SLOT_RE, and footer.\n\nWe patched this locally in the vendored copy and verified that values like /Users/redbeard, $&, , and 81067 are preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions