Skip to content

Fix onclick handlers breaking on source names with special chars#107

Merged
mbuckingham74 merged 1 commit intomainfrom
fix/onclick-quote-escaping
Dec 2, 2025
Merged

Fix onclick handlers breaking on source names with special chars#107
mbuckingham74 merged 1 commit intomainfrom
fix/onclick-quote-escaping

Conversation

@mbuckingham74
Copy link
Owner

Summary

  • Fixes JavaScript "Unexpected end of input" errors on Configure Source page
  • The |tojson filter outputs JSON with double quotes like "Kodiak Area Native Association (KANA)"
  • When placed inside an HTML attribute that also uses double quotes, the HTML parser sees the first " and ends the attribute early
  • Added |e filter to HTML-escape the quotes to "

Root Cause

<!-- Before (broken): -->
onclick="showScrapeModal("Kodiak Area Native Association (KANA)", true)"
                        ^ HTML attribute ends here!

<!-- After (fixed): -->
onclick="showScrapeModal(&quot;Kodiak Area Native Association (KANA)&quot;, true)"

Files Changed

  • configure_source.html - 3 showScrapeModal calls
  • partials/generated_scraper.html - 1 showScrapeModal call
  • partials/source_list.html - 1 openScrapeModal call

Test plan

  • Go to Configure page for "Kodiak Area Native Association (KANA)" - source 39
  • Verify no JS console errors
  • Verify "Run Scraper Now" buttons work
  • Verify "Scrape" button on dashboard works for sources with special chars

🤖 Generated with Claude Code

The |tojson filter outputs JSON with double quotes, which broke HTML
attributes that also use double quotes. Added |e filter to HTML-escape
the quotes to &quot;, allowing names like "Kodiak Area Native Association
(KANA)" to work correctly.

Fixed in:
- configure_source.html (3 showScrapeModal calls)
- partials/generated_scraper.html (1 showScrapeModal call)
- partials/source_list.html (1 openScrapeModal call)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mbuckingham74 mbuckingham74 merged commit 930dcd0 into main Dec 2, 2025
1 check failed
@mbuckingham74 mbuckingham74 deleted the fix/onclick-quote-escaping branch December 2, 2025 12:53
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