Skip to content

Fix JS syntax error when displaying generated scraper code#104

Merged
mbuckingham74 merged 1 commit intomainfrom
fix/scraper-code-html-escape
Dec 2, 2025
Merged

Fix JS syntax error when displaying generated scraper code#104
mbuckingham74 merged 1 commit intomainfrom
fix/scraper-code-html-escape

Conversation

@mbuckingham74
Copy link
Owner

Summary

  • Fixes JavaScript "Unexpected end of input" error on the Configure Source page when a DynamicScraper has generated custom code
  • The generated Python scraper code was being inserted raw into HTML, which broke parsing when the code contained sequences like </script> or </code> in string literals
  • Added the |e (escape) filter to properly HTML-escape the code content in the <pre><code> block

Test plan

  • Go to a source with generated custom scraper code (e.g., Iḷisaġvik College)
  • Verify no JS console errors on the Configure page
  • Verify "Run Custom Scraper Now" button works
  • Verify the generated code displays correctly in the expandable section

🤖 Generated with Claude Code

The generated Python scraper code was being inserted raw into HTML,
which could break parsing if the code contained sequences like
"</script>" or "</code>" in string literals. Added the |e (escape)
filter to properly HTML-escape the code content.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@mbuckingham74 mbuckingham74 merged commit b17462b into main Dec 2, 2025
1 check passed
@mbuckingham74 mbuckingham74 deleted the fix/scraper-code-html-escape branch December 2, 2025 12:17
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